diff options
author | Darren Hart (VMware) <dvhart@infradead.org> | 2017-04-19 20:26:38 -0400 |
---|---|---|
committer | Darren Hart (VMware) <dvhart@infradead.org> | 2017-04-20 16:26:17 -0400 |
commit | c21ee12f460c33fcc12fe162c9ab98f3c58073aa (patch) | |
tree | 2bf1813ef27db7d7bd795d90495c5c81cbc70e89 | |
parent | f9cf3b2880cc41ec2b44aa24fa156bffe934f9c7 (diff) |
platform/x86: hp-wmi: Use DEVICE_ATTR_(RO|RW) helper macros
Use the DEVICE_ATTR_(RO|RW) macros, ranaming the show and store
functions accordingly.
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Tested-by: Carlo Caione <carlo@endlessm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
-rw-r--r-- | drivers/platform/x86/hp-wmi.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 9b71829843ad..d1e3af23a147 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -403,7 +403,7 @@ static int hp_wmi_rfkill2_refresh(void) | |||
403 | return 0; | 403 | return 0; |
404 | } | 404 | } |
405 | 405 | ||
406 | static ssize_t show_display(struct device *dev, struct device_attribute *attr, | 406 | static ssize_t display_show(struct device *dev, struct device_attribute *attr, |
407 | char *buf) | 407 | char *buf) |
408 | { | 408 | { |
409 | int value = hp_wmi_read_int(HPWMI_DISPLAY_QUERY); | 409 | int value = hp_wmi_read_int(HPWMI_DISPLAY_QUERY); |
@@ -412,7 +412,7 @@ static ssize_t show_display(struct device *dev, struct device_attribute *attr, | |||
412 | return sprintf(buf, "%d\n", value); | 412 | return sprintf(buf, "%d\n", value); |
413 | } | 413 | } |
414 | 414 | ||
415 | static ssize_t show_hddtemp(struct device *dev, struct device_attribute *attr, | 415 | static ssize_t hddtemp_show(struct device *dev, struct device_attribute *attr, |
416 | char *buf) | 416 | char *buf) |
417 | { | 417 | { |
418 | int value = hp_wmi_read_int(HPWMI_HDDTEMP_QUERY); | 418 | int value = hp_wmi_read_int(HPWMI_HDDTEMP_QUERY); |
@@ -421,7 +421,7 @@ static ssize_t show_hddtemp(struct device *dev, struct device_attribute *attr, | |||
421 | return sprintf(buf, "%d\n", value); | 421 | return sprintf(buf, "%d\n", value); |
422 | } | 422 | } |
423 | 423 | ||
424 | static ssize_t show_als(struct device *dev, struct device_attribute *attr, | 424 | static ssize_t als_show(struct device *dev, struct device_attribute *attr, |
425 | char *buf) | 425 | char *buf) |
426 | { | 426 | { |
427 | int value = hp_wmi_read_int(HPWMI_ALS_QUERY); | 427 | int value = hp_wmi_read_int(HPWMI_ALS_QUERY); |
@@ -430,7 +430,7 @@ static ssize_t show_als(struct device *dev, struct device_attribute *attr, | |||
430 | return sprintf(buf, "%d\n", value); | 430 | return sprintf(buf, "%d\n", value); |
431 | } | 431 | } |
432 | 432 | ||
433 | static ssize_t show_dock(struct device *dev, struct device_attribute *attr, | 433 | static ssize_t dock_show(struct device *dev, struct device_attribute *attr, |
434 | char *buf) | 434 | char *buf) |
435 | { | 435 | { |
436 | int value = hp_wmi_hw_state(HPWMI_DOCK_MASK); | 436 | int value = hp_wmi_hw_state(HPWMI_DOCK_MASK); |
@@ -439,8 +439,8 @@ static ssize_t show_dock(struct device *dev, struct device_attribute *attr, | |||
439 | return sprintf(buf, "%d\n", value); | 439 | return sprintf(buf, "%d\n", value); |
440 | } | 440 | } |
441 | 441 | ||
442 | static ssize_t show_tablet(struct device *dev, struct device_attribute *attr, | 442 | static ssize_t tablet_show(struct device *dev, struct device_attribute *attr, |
443 | char *buf) | 443 | char *buf) |
444 | { | 444 | { |
445 | int value = hp_wmi_hw_state(HPWMI_TABLET_MASK); | 445 | int value = hp_wmi_hw_state(HPWMI_TABLET_MASK); |
446 | if (value < 0) | 446 | if (value < 0) |
@@ -448,8 +448,8 @@ static ssize_t show_tablet(struct device *dev, struct device_attribute *attr, | |||
448 | return sprintf(buf, "%d\n", value); | 448 | return sprintf(buf, "%d\n", value); |
449 | } | 449 | } |
450 | 450 | ||
451 | static ssize_t show_postcode(struct device *dev, struct device_attribute *attr, | 451 | static ssize_t postcode_show(struct device *dev, struct device_attribute *attr, |
452 | char *buf) | 452 | char *buf) |
453 | { | 453 | { |
454 | /* Get the POST error code of previous boot failure. */ | 454 | /* Get the POST error code of previous boot failure. */ |
455 | int value = hp_wmi_read_int(HPWMI_POSTCODEERROR_QUERY); | 455 | int value = hp_wmi_read_int(HPWMI_POSTCODEERROR_QUERY); |
@@ -458,8 +458,8 @@ static ssize_t show_postcode(struct device *dev, struct device_attribute *attr, | |||
458 | return sprintf(buf, "0x%x\n", value); | 458 | return sprintf(buf, "0x%x\n", value); |
459 | } | 459 | } |
460 | 460 | ||
461 | static ssize_t set_als(struct device *dev, struct device_attribute *attr, | 461 | static ssize_t als_store(struct device *dev, struct device_attribute *attr, |
462 | const char *buf, size_t count) | 462 | const char *buf, size_t count) |
463 | { | 463 | { |
464 | u32 tmp = simple_strtoul(buf, NULL, 10); | 464 | u32 tmp = simple_strtoul(buf, NULL, 10); |
465 | int ret = hp_wmi_perform_query(HPWMI_ALS_QUERY, HPWMI_WRITE, &tmp, | 465 | int ret = hp_wmi_perform_query(HPWMI_ALS_QUERY, HPWMI_WRITE, &tmp, |
@@ -470,8 +470,8 @@ static ssize_t set_als(struct device *dev, struct device_attribute *attr, | |||
470 | return count; | 470 | return count; |
471 | } | 471 | } |
472 | 472 | ||
473 | static ssize_t set_postcode(struct device *dev, struct device_attribute *attr, | 473 | static ssize_t postcode_store(struct device *dev, struct device_attribute *attr, |
474 | const char *buf, size_t count) | 474 | const char *buf, size_t count) |
475 | { | 475 | { |
476 | long unsigned int tmp2; | 476 | long unsigned int tmp2; |
477 | int ret; | 477 | int ret; |
@@ -491,12 +491,12 @@ static ssize_t set_postcode(struct device *dev, struct device_attribute *attr, | |||
491 | return count; | 491 | return count; |
492 | } | 492 | } |
493 | 493 | ||
494 | static DEVICE_ATTR(display, S_IRUGO, show_display, NULL); | 494 | static DEVICE_ATTR_RO(display); |
495 | static DEVICE_ATTR(hddtemp, S_IRUGO, show_hddtemp, NULL); | 495 | static DEVICE_ATTR_RO(hddtemp); |
496 | static DEVICE_ATTR(als, S_IRUGO | S_IWUSR, show_als, set_als); | 496 | static DEVICE_ATTR_RW(als); |
497 | static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL); | 497 | static DEVICE_ATTR_RO(dock); |
498 | static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL); | 498 | static DEVICE_ATTR_RO(tablet); |
499 | static DEVICE_ATTR(postcode, S_IRUGO | S_IWUSR, show_postcode, set_postcode); | 499 | static DEVICE_ATTR_RW(postcode); |
500 | 500 | ||
501 | static void hp_wmi_notify(u32 value, void *context) | 501 | static void hp_wmi_notify(u32 value, void *context) |
502 | { | 502 | { |