diff options
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r-- | drivers/net/cxgb3/cxgb3_main.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 43583ed655ab..59f2b518c926 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -434,27 +434,25 @@ static int setup_sge_qsets(struct adapter *adap) | |||
434 | 434 | ||
435 | static ssize_t attr_show(struct device *d, struct device_attribute *attr, | 435 | static ssize_t attr_show(struct device *d, struct device_attribute *attr, |
436 | char *buf, | 436 | char *buf, |
437 | ssize_t(*format) (struct adapter *, char *)) | 437 | ssize_t(*format) (struct net_device *, char *)) |
438 | { | 438 | { |
439 | ssize_t len; | 439 | ssize_t len; |
440 | struct adapter *adap = to_net_dev(d)->priv; | ||
441 | 440 | ||
442 | /* Synchronize with ioctls that may shut down the device */ | 441 | /* Synchronize with ioctls that may shut down the device */ |
443 | rtnl_lock(); | 442 | rtnl_lock(); |
444 | len = (*format) (adap, buf); | 443 | len = (*format) (to_net_dev(d), buf); |
445 | rtnl_unlock(); | 444 | rtnl_unlock(); |
446 | return len; | 445 | return len; |
447 | } | 446 | } |
448 | 447 | ||
449 | static ssize_t attr_store(struct device *d, struct device_attribute *attr, | 448 | static ssize_t attr_store(struct device *d, struct device_attribute *attr, |
450 | const char *buf, size_t len, | 449 | const char *buf, size_t len, |
451 | ssize_t(*set) (struct adapter *, unsigned int), | 450 | ssize_t(*set) (struct net_device *, unsigned int), |
452 | unsigned int min_val, unsigned int max_val) | 451 | unsigned int min_val, unsigned int max_val) |
453 | { | 452 | { |
454 | char *endp; | 453 | char *endp; |
455 | ssize_t ret; | 454 | ssize_t ret; |
456 | unsigned int val; | 455 | unsigned int val; |
457 | struct adapter *adap = to_net_dev(d)->priv; | ||
458 | 456 | ||
459 | if (!capable(CAP_NET_ADMIN)) | 457 | if (!capable(CAP_NET_ADMIN)) |
460 | return -EPERM; | 458 | return -EPERM; |
@@ -464,7 +462,7 @@ static ssize_t attr_store(struct device *d, struct device_attribute *attr, | |||
464 | return -EINVAL; | 462 | return -EINVAL; |
465 | 463 | ||
466 | rtnl_lock(); | 464 | rtnl_lock(); |
467 | ret = (*set) (adap, val); | 465 | ret = (*set) (to_net_dev(d), val); |
468 | if (!ret) | 466 | if (!ret) |
469 | ret = len; | 467 | ret = len; |
470 | rtnl_unlock(); | 468 | rtnl_unlock(); |
@@ -472,8 +470,9 @@ static ssize_t attr_store(struct device *d, struct device_attribute *attr, | |||
472 | } | 470 | } |
473 | 471 | ||
474 | #define CXGB3_SHOW(name, val_expr) \ | 472 | #define CXGB3_SHOW(name, val_expr) \ |
475 | static ssize_t format_##name(struct adapter *adap, char *buf) \ | 473 | static ssize_t format_##name(struct net_device *dev, char *buf) \ |
476 | { \ | 474 | { \ |
475 | struct adapter *adap = dev->priv; \ | ||
477 | return sprintf(buf, "%u\n", val_expr); \ | 476 | return sprintf(buf, "%u\n", val_expr); \ |
478 | } \ | 477 | } \ |
479 | static ssize_t show_##name(struct device *d, struct device_attribute *attr, \ | 478 | static ssize_t show_##name(struct device *d, struct device_attribute *attr, \ |
@@ -482,8 +481,10 @@ static ssize_t show_##name(struct device *d, struct device_attribute *attr, \ | |||
482 | return attr_show(d, attr, buf, format_##name); \ | 481 | return attr_show(d, attr, buf, format_##name); \ |
483 | } | 482 | } |
484 | 483 | ||
485 | static ssize_t set_nfilters(struct adapter *adap, unsigned int val) | 484 | static ssize_t set_nfilters(struct net_device *dev, unsigned int val) |
486 | { | 485 | { |
486 | struct adapter *adap = dev->priv; | ||
487 | |||
487 | if (adap->flags & FULL_INIT_DONE) | 488 | if (adap->flags & FULL_INIT_DONE) |
488 | return -EBUSY; | 489 | return -EBUSY; |
489 | if (val && adap->params.rev == 0) | 490 | if (val && adap->params.rev == 0) |
@@ -500,8 +501,10 @@ static ssize_t store_nfilters(struct device *d, struct device_attribute *attr, | |||
500 | return attr_store(d, attr, buf, len, set_nfilters, 0, ~0); | 501 | return attr_store(d, attr, buf, len, set_nfilters, 0, ~0); |
501 | } | 502 | } |
502 | 503 | ||
503 | static ssize_t set_nservers(struct adapter *adap, unsigned int val) | 504 | static ssize_t set_nservers(struct net_device *dev, unsigned int val) |
504 | { | 505 | { |
506 | struct adapter *adap = dev->priv; | ||
507 | |||
505 | if (adap->flags & FULL_INIT_DONE) | 508 | if (adap->flags & FULL_INIT_DONE) |
506 | return -EBUSY; | 509 | return -EBUSY; |
507 | if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters) | 510 | if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters) |