* [Patch v2 10/10] platform/x86/asus-wmi: using dev_get_drvdata directly
@ 2019-07-04 2:36 Fuqian Huang
2019-07-04 13:25 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Fuqian Huang @ 2019-07-04 2:36 UTC (permalink / raw)
Cc: Corentin Chary, Darren Hart, Andy Shevchenko, acpi4asus-user,
platform-driver-x86, linux-kernel, Fuqian Huang
Several drivers cast a struct device pointer to a struct
platform_device pointer only to then call platform_get_drvdata().
To improve readability, these constructs can be simplified
by using dev_get_drvdata() directly.
Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
---
Changes in v2:
- Make the commit message more clearly.
drivers/platform/x86/asus-wmi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 9b18a184e0aa..49049b02a015 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1353,8 +1353,7 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
struct attribute *attr, int idx)
{
struct device *dev = container_of(kobj, struct device, kobj);
- struct platform_device *pdev = to_platform_device(dev->parent);
- struct asus_wmi *asus = platform_get_drvdata(pdev);
+ struct asus_wmi *asus = dev_get_drvdata(dev->parent);
int dev_id = -1;
int fan_attr = -1;
u32 value = ASUS_WMI_UNSUPPORTED_METHOD;
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch v2 10/10] platform/x86/asus-wmi: using dev_get_drvdata directly
2019-07-04 2:36 [Patch v2 10/10] platform/x86/asus-wmi: using dev_get_drvdata directly Fuqian Huang
@ 2019-07-04 13:25 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2019-07-04 13:25 UTC (permalink / raw)
To: Fuqian Huang
Cc: Corentin Chary, Darren Hart, Andy Shevchenko, acpi4asus-user,
Platform Driver, Linux Kernel Mailing List
On Thu, Jul 4, 2019 at 5:37 AM Fuqian Huang <huangfq.daxian@gmail.com> wrote:
>
> Several drivers cast a struct device pointer to a struct
> platform_device pointer only to then call platform_get_drvdata().
> To improve readability, these constructs can be simplified
> by using dev_get_drvdata() directly.
v1 had been applied.
> Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
> ---
> Changes in v2:
> - Make the commit message more clearly.
>
> drivers/platform/x86/asus-wmi.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 9b18a184e0aa..49049b02a015 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -1353,8 +1353,7 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
> struct attribute *attr, int idx)
> {
> struct device *dev = container_of(kobj, struct device, kobj);
> - struct platform_device *pdev = to_platform_device(dev->parent);
> - struct asus_wmi *asus = platform_get_drvdata(pdev);
> + struct asus_wmi *asus = dev_get_drvdata(dev->parent);
> int dev_id = -1;
> int fan_attr = -1;
> u32 value = ASUS_WMI_UNSUPPORTED_METHOD;
> --
> 2.11.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-04 13:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-04 2:36 [Patch v2 10/10] platform/x86/asus-wmi: using dev_get_drvdata directly Fuqian Huang
2019-07-04 13:25 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).