~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/s390/net/qeth_core_sys.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
530
530
static DEVICE_ATTR(isolation, 0644, qeth_dev_isolation_show,
531
531
                   qeth_dev_isolation_store);
532
532
 
 
533
static ssize_t qeth_hw_trap_show(struct device *dev,
 
534
                                struct device_attribute *attr, char *buf)
 
535
{
 
536
        struct qeth_card *card = dev_get_drvdata(dev);
 
537
 
 
538
        if (!card)
 
539
                return -EINVAL;
 
540
        if (card->info.hwtrap)
 
541
                return snprintf(buf, 5, "arm\n");
 
542
        else
 
543
                return snprintf(buf, 8, "disarm\n");
 
544
}
 
545
 
 
546
static ssize_t qeth_hw_trap_store(struct device *dev,
 
547
                struct device_attribute *attr, const char *buf, size_t count)
 
548
{
 
549
        struct qeth_card *card = dev_get_drvdata(dev);
 
550
        int rc = 0;
 
551
        char *tmp, *curtoken;
 
552
        int state = 0;
 
553
        curtoken = (char *)buf;
 
554
 
 
555
        if (!card)
 
556
                return -EINVAL;
 
557
 
 
558
        mutex_lock(&card->conf_mutex);
 
559
        if (card->state == CARD_STATE_SOFTSETUP || card->state == CARD_STATE_UP)
 
560
                state = 1;
 
561
        tmp = strsep(&curtoken, "\n");
 
562
 
 
563
        if (!strcmp(tmp, "arm") && !card->info.hwtrap) {
 
564
                if (state) {
 
565
                        if (qeth_is_diagass_supported(card,
 
566
                            QETH_DIAGS_CMD_TRAP)) {
 
567
                                rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_ARM);
 
568
                                if (!rc)
 
569
                                        card->info.hwtrap = 1;
 
570
                        } else
 
571
                                rc = -EINVAL;
 
572
                } else
 
573
                        card->info.hwtrap = 1;
 
574
        } else if (!strcmp(tmp, "disarm") && card->info.hwtrap) {
 
575
                if (state) {
 
576
                        rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM);
 
577
                        if (!rc)
 
578
                                card->info.hwtrap = 0;
 
579
                } else
 
580
                        card->info.hwtrap = 0;
 
581
        } else if (!strcmp(tmp, "trap") && state && card->info.hwtrap)
 
582
                rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_CAPTURE);
 
583
        else
 
584
                rc = -EINVAL;
 
585
 
 
586
        mutex_unlock(&card->conf_mutex);
 
587
        return rc ? rc : count;
 
588
}
 
589
 
 
590
static DEVICE_ATTR(hw_trap, 0644, qeth_hw_trap_show,
 
591
                   qeth_hw_trap_store);
 
592
 
533
593
static ssize_t qeth_dev_blkt_show(char *buf, struct qeth_card *card, int value)
534
594
{
535
595
 
653
713
        &dev_attr_performance_stats.attr,
654
714
        &dev_attr_layer2.attr,
655
715
        &dev_attr_isolation.attr,
 
716
        &dev_attr_hw_trap.attr,
656
717
        NULL,
657
718
};
658
719