* [PATCH] acpi: fan.c: printk replacement @ 2014-08-22 12:03 Sudip Mukherjee 2014-08-25 22:45 ` Rafael J. Wysocki 0 siblings, 1 reply; 9+ messages in thread From: Sudip Mukherjee @ 2014-08-22 12:03 UTC (permalink / raw) To: Zhang Rui, Rafael J. Wysocki, Len Brown Cc: Sudip Mukherjee, linux-acpi, linux-kernel printk replaced with corresponding dev_err and dev_info fixed one broken user-visible string multiine comment edited for correct commenting style asm/uaccess.h replaced with linux/uaccess.h Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> --- drivers/acpi/fan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 8acf53e..7900d55 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -27,7 +27,7 @@ #include <linux/module.h> #include <linux/init.h> #include <linux/types.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/thermal.h> #include <linux/acpi.h> @@ -127,8 +127,9 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { }; /* -------------------------------------------------------------------------- - Driver Interface - -------------------------------------------------------------------------- */ + * Driver Interface + * -------------------------------------------------------------------------- +*/ static int acpi_fan_add(struct acpi_device *device) { @@ -143,7 +144,7 @@ static int acpi_fan_add(struct acpi_device *device) result = acpi_bus_update_power(device->handle, NULL); if (result) { - printk(KERN_ERR PREFIX "Setting initial power state\n"); + dev_err(&device->dev, PREFIX "Setting initial power state\n"); goto end; } @@ -168,10 +169,10 @@ static int acpi_fan_add(struct acpi_device *device) &device->dev.kobj, "device"); if (result) - dev_err(&device->dev, "Failed to create sysfs link " - "'device'\n"); + dev_err(&device->dev, + "Failed to create sysfs link 'device'\n"); - printk(KERN_INFO PREFIX "%s [%s] (%s)\n", + dev_info(&device->dev, PREFIX "%s [%s] (%s)\n", acpi_device_name(device), acpi_device_bid(device), !device->power.state ? "on" : "off"); @@ -214,10 +215,9 @@ static int acpi_fan_resume(struct device *dev) if (!dev) return -EINVAL; - result = acpi_bus_update_power(to_acpi_device(dev)->handle, NULL); if (result) - printk(KERN_ERR PREFIX "Error updating fan power state\n"); + dev_err(dev, PREFIX "Error updating fan power state\n"); return result; } -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] acpi: fan.c: printk replacement 2014-08-22 12:03 [PATCH] acpi: fan.c: printk replacement Sudip Mukherjee @ 2014-08-25 22:45 ` Rafael J. Wysocki 2014-08-26 15:30 ` Sudip Mukherjee 0 siblings, 1 reply; 9+ messages in thread From: Rafael J. Wysocki @ 2014-08-25 22:45 UTC (permalink / raw) To: Sudip Mukherjee; +Cc: Zhang Rui, Len Brown, linux-acpi, linux-kernel On Friday, August 22, 2014 05:33:21 PM Sudip Mukherjee wrote: > printk replaced with corresponding dev_err and dev_info > fixed one broken user-visible string > multiine comment edited for correct commenting style > asm/uaccess.h replaced with linux/uaccess.h > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> > --- > drivers/acpi/fan.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c > index 8acf53e..7900d55 100644 > --- a/drivers/acpi/fan.c > +++ b/drivers/acpi/fan.c > @@ -27,7 +27,7 @@ > #include <linux/module.h> > #include <linux/init.h> > #include <linux/types.h> > -#include <asm/uaccess.h> > +#include <linux/uaccess.h> > #include <linux/thermal.h> > #include <linux/acpi.h> > > @@ -127,8 +127,9 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { > }; > > /* -------------------------------------------------------------------------- > - Driver Interface > - -------------------------------------------------------------------------- */ > + * Driver Interface > + * -------------------------------------------------------------------------- > +*/ > > static int acpi_fan_add(struct acpi_device *device) > { > @@ -143,7 +144,7 @@ static int acpi_fan_add(struct acpi_device *device) > > result = acpi_bus_update_power(device->handle, NULL); > if (result) { > - printk(KERN_ERR PREFIX "Setting initial power state\n"); > + dev_err(&device->dev, PREFIX "Setting initial power state\n"); While at it, please define a proper pr_fmt() for this file and get rid of PREFIX too. Otherwise I don't see a compelling reason to apply this. > goto end; > } > > @@ -168,10 +169,10 @@ static int acpi_fan_add(struct acpi_device *device) > &device->dev.kobj, > "device"); > if (result) > - dev_err(&device->dev, "Failed to create sysfs link " > - "'device'\n"); > + dev_err(&device->dev, > + "Failed to create sysfs link 'device'\n"); > > - printk(KERN_INFO PREFIX "%s [%s] (%s)\n", > + dev_info(&device->dev, PREFIX "%s [%s] (%s)\n", > acpi_device_name(device), acpi_device_bid(device), > !device->power.state ? "on" : "off"); > > @@ -214,10 +215,9 @@ static int acpi_fan_resume(struct device *dev) > > if (!dev) > return -EINVAL; > - That empty line is intentional, please don't remove it. Moreover, in any case this change doesn't belong to your patch. > result = acpi_bus_update_power(to_acpi_device(dev)->handle, NULL); > if (result) > - printk(KERN_ERR PREFIX "Error updating fan power state\n"); > + dev_err(dev, PREFIX "Error updating fan power state\n"); > > return result; > } > -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] acpi: fan.c: printk replacement 2014-08-25 22:45 ` Rafael J. Wysocki @ 2014-08-26 15:30 ` Sudip Mukherjee 2014-08-26 21:02 ` Rafael J. Wysocki 0 siblings, 1 reply; 9+ messages in thread From: Sudip Mukherjee @ 2014-08-26 15:30 UTC (permalink / raw) To: Rafael J. Wysocki; +Cc: Zhang Rui, Len Brown, linux-acpi, linux-kernel On Tue, Aug 26, 2014 at 12:45:20AM +0200, Rafael J. Wysocki wrote: > On Friday, August 22, 2014 05:33:21 PM Sudip Mukherjee wrote: > > printk replaced with corresponding dev_err and dev_info > > fixed one broken user-visible string > > multiine comment edited for correct commenting style > > asm/uaccess.h replaced with linux/uaccess.h > > > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> > > --- > > drivers/acpi/fan.c | 18 +++++++++--------- > > 1 file changed, 9 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c > > index 8acf53e..7900d55 100644 > > --- a/drivers/acpi/fan.c > > +++ b/drivers/acpi/fan.c > > @@ -27,7 +27,7 @@ > > #include <linux/module.h> > > #include <linux/init.h> > > #include <linux/types.h> > > -#include <asm/uaccess.h> > > +#include <linux/uaccess.h> > > #include <linux/thermal.h> > > #include <linux/acpi.h> > > > > @@ -127,8 +127,9 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { > > }; > > > > /* -------------------------------------------------------------------------- > > - Driver Interface > > - -------------------------------------------------------------------------- */ > > + * Driver Interface > > + * -------------------------------------------------------------------------- > > +*/ > > > > static int acpi_fan_add(struct acpi_device *device) > > { > > @@ -143,7 +144,7 @@ static int acpi_fan_add(struct acpi_device *device) > > > > result = acpi_bus_update_power(device->handle, NULL); > > if (result) { > > - printk(KERN_ERR PREFIX "Setting initial power state\n"); > > + dev_err(&device->dev, PREFIX "Setting initial power state\n"); > > While at it, please define a proper pr_fmt() for this file and get rid of PREFIX > too. > > Otherwise I don't see a compelling reason to apply this. > Hi, Since in the patch I am not using any pr_* , so I am unable to understand why you are asking for a proper pr_fmt(). I can get rid of the PREFIX . Then should I use pr_* in the patch instead of dev_* ? My understanding was dev_* is more preffered than pr_*. waiting for your suggestion on this. thanks sudip > > > > -- > I speak only for myself. > Rafael J. Wysocki, Intel Open Source Technology Center. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] acpi: fan.c: printk replacement 2014-08-26 15:30 ` Sudip Mukherjee @ 2014-08-26 21:02 ` Rafael J. Wysocki 2014-08-26 20:59 ` Joe Perches 0 siblings, 1 reply; 9+ messages in thread From: Rafael J. Wysocki @ 2014-08-26 21:02 UTC (permalink / raw) To: Sudip Mukherjee; +Cc: Zhang Rui, Len Brown, linux-acpi, linux-kernel On Tuesday, August 26, 2014 09:00:39 PM Sudip Mukherjee wrote: > On Tue, Aug 26, 2014 at 12:45:20AM +0200, Rafael J. Wysocki wrote: > > On Friday, August 22, 2014 05:33:21 PM Sudip Mukherjee wrote: > > > printk replaced with corresponding dev_err and dev_info > > > fixed one broken user-visible string > > > multiine comment edited for correct commenting style > > > asm/uaccess.h replaced with linux/uaccess.h > > > > > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> > > > --- > > > drivers/acpi/fan.c | 18 +++++++++--------- > > > 1 file changed, 9 insertions(+), 9 deletions(-) > > > > > > diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c > > > index 8acf53e..7900d55 100644 > > > --- a/drivers/acpi/fan.c > > > +++ b/drivers/acpi/fan.c > > > @@ -27,7 +27,7 @@ > > > #include <linux/module.h> > > > #include <linux/init.h> > > > #include <linux/types.h> > > > -#include <asm/uaccess.h> > > > +#include <linux/uaccess.h> > > > #include <linux/thermal.h> > > > #include <linux/acpi.h> > > > > > > @@ -127,8 +127,9 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { > > > }; > > > > > > /* -------------------------------------------------------------------------- > > > - Driver Interface > > > - -------------------------------------------------------------------------- */ > > > + * Driver Interface > > > + * -------------------------------------------------------------------------- > > > +*/ > > > > > > static int acpi_fan_add(struct acpi_device *device) > > > { > > > @@ -143,7 +144,7 @@ static int acpi_fan_add(struct acpi_device *device) > > > > > > result = acpi_bus_update_power(device->handle, NULL); > > > if (result) { > > > - printk(KERN_ERR PREFIX "Setting initial power state\n"); > > > + dev_err(&device->dev, PREFIX "Setting initial power state\n"); > > > > While at it, please define a proper pr_fmt() for this file and get rid of PREFIX > > too. > > > > Otherwise I don't see a compelling reason to apply this. > > > > Hi, > Since in the patch I am not using any pr_* , so I am unable to understand why > you are asking for a proper pr_fmt(). Never mind, I was confused somehow, not exactly sure why. Sorry about that. > I can get rid of the PREFIX . Then should I use pr_* in the patch instead of dev_* ? > My understanding was dev_* is more preffered than pr_*. > waiting for your suggestion on this. Well, that really depends on the particular case. It really is better to use dev_err() here, but then PREFIX with it is not really useful, so please just drop PREFIX from the new messages. Rafael ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] acpi: fan.c: printk replacement 2014-08-26 21:02 ` Rafael J. Wysocki @ 2014-08-26 20:59 ` Joe Perches 2014-08-26 21:22 ` Rafael J. Wysocki 0 siblings, 1 reply; 9+ messages in thread From: Joe Perches @ 2014-08-26 20:59 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Sudip Mukherjee, Zhang Rui, Len Brown, linux-acpi, linux-kernel On Tue, 2014-08-26 at 23:02 +0200, Rafael J. Wysocki wrote: > On Tuesday, August 26, 2014 09:00:39 PM Sudip Mukherjee wrote: > > On Tue, Aug 26, 2014 at 12:45:20AM +0200, Rafael J. Wysocki wrote: > > > On Friday, August 22, 2014 05:33:21 PM Sudip Mukherjee wrote: > > > > printk replaced with corresponding dev_err and dev_info > > > > fixed one broken user-visible string > > > > multiine comment edited for correct commenting style > > > > asm/uaccess.h replaced with linux/uaccess.h > > > > > > > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> > > > > --- > > > > drivers/acpi/fan.c | 18 +++++++++--------- > > > > 1 file changed, 9 insertions(+), 9 deletions(-) > > > > > > > > diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c > > > > index 8acf53e..7900d55 100644 > > > > --- a/drivers/acpi/fan.c > > > > +++ b/drivers/acpi/fan.c > > > > @@ -27,7 +27,7 @@ > > > > #include <linux/module.h> > > > > #include <linux/init.h> > > > > #include <linux/types.h> > > > > -#include <asm/uaccess.h> > > > > +#include <linux/uaccess.h> > > > > #include <linux/thermal.h> > > > > #include <linux/acpi.h> > > > > > > > > @@ -127,8 +127,9 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { > > > > }; > > > > > > > > /* -------------------------------------------------------------------------- > > > > - Driver Interface > > > > - -------------------------------------------------------------------------- */ > > > > + * Driver Interface > > > > + * -------------------------------------------------------------------------- > > > > +*/ > > > > > > > > static int acpi_fan_add(struct acpi_device *device) > > > > { > > > > @@ -143,7 +144,7 @@ static int acpi_fan_add(struct acpi_device *device) > > > > > > > > result = acpi_bus_update_power(device->handle, NULL); > > > > if (result) { > > > > - printk(KERN_ERR PREFIX "Setting initial power state\n"); > > > > + dev_err(&device->dev, PREFIX "Setting initial power state\n"); > > > > > > While at it, please define a proper pr_fmt() for this file and get rid of PREFIX > > > too. > > > > > > Otherwise I don't see a compelling reason to apply this. > > > > > > > Hi, > > Since in the patch I am not using any pr_* , so I am unable to understand why > > you are asking for a proper pr_fmt(). > > Never mind, I was confused somehow, not exactly sure why. Sorry about that. > > > I can get rid of the PREFIX . Then should I use pr_* in the patch instead of dev_* ? > > My understanding was dev_* is more preffered than pr_*. > > waiting for your suggestion on this. > > Well, that really depends on the particular case. It really is better to use > dev_err() here, but then PREFIX with it is not really useful, so please just > drop PREFIX from the new messages. PREFIX is "ACPI: " so I think the idea is to be able to grep for that. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] acpi: fan.c: printk replacement 2014-08-26 20:59 ` Joe Perches @ 2014-08-26 21:22 ` Rafael J. Wysocki 2014-08-27 4:57 ` Sudip Mukherjee 0 siblings, 1 reply; 9+ messages in thread From: Rafael J. Wysocki @ 2014-08-26 21:22 UTC (permalink / raw) To: Joe Perches Cc: Sudip Mukherjee, Zhang Rui, Len Brown, linux-acpi, linux-kernel On Tuesday, August 26, 2014 01:59:02 PM Joe Perches wrote: > On Tue, 2014-08-26 at 23:02 +0200, Rafael J. Wysocki wrote: > > On Tuesday, August 26, 2014 09:00:39 PM Sudip Mukherjee wrote: > > > On Tue, Aug 26, 2014 at 12:45:20AM +0200, Rafael J. Wysocki wrote: > > > > On Friday, August 22, 2014 05:33:21 PM Sudip Mukherjee wrote: > > > > > printk replaced with corresponding dev_err and dev_info > > > > > fixed one broken user-visible string > > > > > multiine comment edited for correct commenting style > > > > > asm/uaccess.h replaced with linux/uaccess.h > > > > > > > > > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> > > > > > --- > > > > > drivers/acpi/fan.c | 18 +++++++++--------- > > > > > 1 file changed, 9 insertions(+), 9 deletions(-) > > > > > > > > > > diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c > > > > > index 8acf53e..7900d55 100644 > > > > > --- a/drivers/acpi/fan.c > > > > > +++ b/drivers/acpi/fan.c > > > > > @@ -27,7 +27,7 @@ > > > > > #include <linux/module.h> > > > > > #include <linux/init.h> > > > > > #include <linux/types.h> > > > > > -#include <asm/uaccess.h> > > > > > +#include <linux/uaccess.h> > > > > > #include <linux/thermal.h> > > > > > #include <linux/acpi.h> > > > > > > > > > > @@ -127,8 +127,9 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { > > > > > }; > > > > > > > > > > /* -------------------------------------------------------------------------- > > > > > - Driver Interface > > > > > - -------------------------------------------------------------------------- */ > > > > > + * Driver Interface > > > > > + * -------------------------------------------------------------------------- > > > > > +*/ > > > > > > > > > > static int acpi_fan_add(struct acpi_device *device) > > > > > { > > > > > @@ -143,7 +144,7 @@ static int acpi_fan_add(struct acpi_device *device) > > > > > > > > > > result = acpi_bus_update_power(device->handle, NULL); > > > > > if (result) { > > > > > - printk(KERN_ERR PREFIX "Setting initial power state\n"); > > > > > + dev_err(&device->dev, PREFIX "Setting initial power state\n"); > > > > > > > > While at it, please define a proper pr_fmt() for this file and get rid of PREFIX > > > > too. > > > > > > > > Otherwise I don't see a compelling reason to apply this. > > > > > > > > > > Hi, > > > Since in the patch I am not using any pr_* , so I am unable to understand why > > > you are asking for a proper pr_fmt(). > > > > Never mind, I was confused somehow, not exactly sure why. Sorry about that. > > > > > I can get rid of the PREFIX . Then should I use pr_* in the patch instead of dev_* ? > > > My understanding was dev_* is more preffered than pr_*. > > > waiting for your suggestion on this. > > > > Well, that really depends on the particular case. It really is better to use > > dev_err() here, but then PREFIX with it is not really useful, so please just > > drop PREFIX from the new messages. > > PREFIX is "ACPI: " so I think the idea is > to be able to grep for that. I'm not sure how useful that is in this particular case. You can grep for "power state" istead just fine ... Rafael ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] acpi: fan.c: printk replacement 2014-08-26 21:22 ` Rafael J. Wysocki @ 2014-08-27 4:57 ` Sudip Mukherjee 2014-08-27 23:26 ` Rafael J. Wysocki 0 siblings, 1 reply; 9+ messages in thread From: Sudip Mukherjee @ 2014-08-27 4:57 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Joe Perches, Zhang Rui, Len Brown, linux-acpi, linux-kernel On Tue, Aug 26, 2014 at 11:22:12PM +0200, Rafael J. Wysocki wrote: > On Tuesday, August 26, 2014 01:59:02 PM Joe Perches wrote: > > On Tue, 2014-08-26 at 23:02 +0200, Rafael J. Wysocki wrote: > > > On Tuesday, August 26, 2014 09:00:39 PM Sudip Mukherjee wrote: > > > > On Tue, Aug 26, 2014 at 12:45:20AM +0200, Rafael J. Wysocki wrote: > > > > > On Friday, August 22, 2014 05:33:21 PM Sudip Mukherjee wrote: > > > > > > printk replaced with corresponding dev_err and dev_info > > > > > > fixed one broken user-visible string > > > > > > multiine comment edited for correct commenting style > > > > > > asm/uaccess.h replaced with linux/uaccess.h > > > > > > > > > > > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> > > > > > > --- > > > > > > drivers/acpi/fan.c | 18 +++++++++--------- > > > > > > 1 file changed, 9 insertions(+), 9 deletions(-) > > > > > > > > > > > > diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c > > > > > > index 8acf53e..7900d55 100644 > > > > > > --- a/drivers/acpi/fan.c > > > > > > +++ b/drivers/acpi/fan.c > > > > > > @@ -27,7 +27,7 @@ > > > > > > #include <linux/module.h> > > > > > > #include <linux/init.h> > > > > > > #include <linux/types.h> > > > > > > -#include <asm/uaccess.h> > > > > > > +#include <linux/uaccess.h> > > > > > > #include <linux/thermal.h> > > > > > > #include <linux/acpi.h> > > > > > > > > > > > > @@ -127,8 +127,9 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { > > > > > > }; > > > > > > > > > > > > /* -------------------------------------------------------------------------- > > > > > > - Driver Interface > > > > > > - -------------------------------------------------------------------------- */ > > > > > > + * Driver Interface > > > > > > + * -------------------------------------------------------------------------- > > > > > > +*/ > > > > > > > > > > > > static int acpi_fan_add(struct acpi_device *device) > > > > > > { > > > > > > @@ -143,7 +144,7 @@ static int acpi_fan_add(struct acpi_device *device) > > > > > > > > > > > > result = acpi_bus_update_power(device->handle, NULL); > > > > > > if (result) { > > > > > > - printk(KERN_ERR PREFIX "Setting initial power state\n"); > > > > > > + dev_err(&device->dev, PREFIX "Setting initial power state\n"); > > > > > > > > > > While at it, please define a proper pr_fmt() for this file and get rid of PREFIX > > > > > too. > > > > > > > > > > Otherwise I don't see a compelling reason to apply this. > > > > > > > > > > > > > Hi, > > > > Since in the patch I am not using any pr_* , so I am unable to understand why > > > > you are asking for a proper pr_fmt(). > > > > > > Never mind, I was confused somehow, not exactly sure why. Sorry about that. > > > > > > > I can get rid of the PREFIX . Then should I use pr_* in the patch instead of dev_* ? > > > > My understanding was dev_* is more preffered than pr_*. > > > > waiting for your suggestion on this. > > > > > > Well, that really depends on the particular case. It really is better to use > > > dev_err() here, but then PREFIX with it is not really useful, so please just > > > drop PREFIX from the new messages. > > > > PREFIX is "ACPI: " so I think the idea is > > to be able to grep for that. > > I'm not sure how useful that is in this particular case. You can grep for "power > state" istead just fine ... > > Rafael > Then there is one more printk which prints fan state is on or off : >dev_info(&device->dev, PREFIX "%s [%s] (%s)\n", > acpi_device_name(device), acpi_device_bid(device), > !device->power.state ? "on" : "off"); So if we drop the PREFIX and if some one wants to grep for this fan on/off , then how to do that .. after removing PREFIX , in dmesg I am getting it as : [ 2.056204] fan PNP0C0B:00: Fan [FAN0] (off) [ 2.056225] fan PNP0C0B:01: Fan [FAN1] (off) [ 2.056245] fan PNP0C0B:02: Fan [FAN2] (off) [ 2.056263] fan PNP0C0B:03: Fan [FAN3] (off) [ 2.056283] fan PNP0C0B:04: Fan [FAN4] (off) thanks sudip ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] acpi: fan.c: printk replacement 2014-08-27 4:57 ` Sudip Mukherjee @ 2014-08-27 23:26 ` Rafael J. Wysocki 2014-08-28 12:29 ` Sudip Mukherjee 0 siblings, 1 reply; 9+ messages in thread From: Rafael J. Wysocki @ 2014-08-27 23:26 UTC (permalink / raw) To: Sudip Mukherjee Cc: Joe Perches, Zhang Rui, Len Brown, linux-acpi, linux-kernel On Wednesday, August 27, 2014 10:27:47 AM Sudip Mukherjee wrote: > On Tue, Aug 26, 2014 at 11:22:12PM +0200, Rafael J. Wysocki wrote: > > On Tuesday, August 26, 2014 01:59:02 PM Joe Perches wrote: > > > On Tue, 2014-08-26 at 23:02 +0200, Rafael J. Wysocki wrote: > > > > On Tuesday, August 26, 2014 09:00:39 PM Sudip Mukherjee wrote: > > > > > On Tue, Aug 26, 2014 at 12:45:20AM +0200, Rafael J. Wysocki wrote: > > > > > > On Friday, August 22, 2014 05:33:21 PM Sudip Mukherjee wrote: > > > > > > > printk replaced with corresponding dev_err and dev_info > > > > > > > fixed one broken user-visible string > > > > > > > multiine comment edited for correct commenting style > > > > > > > asm/uaccess.h replaced with linux/uaccess.h > > > > > > > > > > > > > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> > > > > > > > --- > > > > > > > drivers/acpi/fan.c | 18 +++++++++--------- > > > > > > > 1 file changed, 9 insertions(+), 9 deletions(-) > > > > > > > > > > > > > > diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c > > > > > > > index 8acf53e..7900d55 100644 > > > > > > > --- a/drivers/acpi/fan.c > > > > > > > +++ b/drivers/acpi/fan.c > > > > > > > @@ -27,7 +27,7 @@ > > > > > > > #include <linux/module.h> > > > > > > > #include <linux/init.h> > > > > > > > #include <linux/types.h> > > > > > > > -#include <asm/uaccess.h> > > > > > > > +#include <linux/uaccess.h> > > > > > > > #include <linux/thermal.h> > > > > > > > #include <linux/acpi.h> > > > > > > > > > > > > > > @@ -127,8 +127,9 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { > > > > > > > }; > > > > > > > > > > > > > > /* -------------------------------------------------------------------------- > > > > > > > - Driver Interface > > > > > > > - -------------------------------------------------------------------------- */ > > > > > > > + * Driver Interface > > > > > > > + * -------------------------------------------------------------------------- > > > > > > > +*/ > > > > > > > > > > > > > > static int acpi_fan_add(struct acpi_device *device) > > > > > > > { > > > > > > > @@ -143,7 +144,7 @@ static int acpi_fan_add(struct acpi_device *device) > > > > > > > > > > > > > > result = acpi_bus_update_power(device->handle, NULL); > > > > > > > if (result) { > > > > > > > - printk(KERN_ERR PREFIX "Setting initial power state\n"); > > > > > > > + dev_err(&device->dev, PREFIX "Setting initial power state\n"); > > > > > > > > > > > > While at it, please define a proper pr_fmt() for this file and get rid of PREFIX > > > > > > too. > > > > > > > > > > > > Otherwise I don't see a compelling reason to apply this. > > > > > > > > > > > > > > > > Hi, > > > > > Since in the patch I am not using any pr_* , so I am unable to understand why > > > > > you are asking for a proper pr_fmt(). > > > > > > > > Never mind, I was confused somehow, not exactly sure why. Sorry about that. > > > > > > > > > I can get rid of the PREFIX . Then should I use pr_* in the patch instead of dev_* ? > > > > > My understanding was dev_* is more preffered than pr_*. > > > > > waiting for your suggestion on this. > > > > > > > > Well, that really depends on the particular case. It really is better to use > > > > dev_err() here, but then PREFIX with it is not really useful, so please just > > > > drop PREFIX from the new messages. > > > > > > PREFIX is "ACPI: " so I think the idea is > > > to be able to grep for that. > > > > I'm not sure how useful that is in this particular case. You can grep for "power > > state" istead just fine ... > > > > Rafael > > > > Then there is one more printk which prints fan state is on or off : > > >dev_info(&device->dev, PREFIX "%s [%s] (%s)\n", > > acpi_device_name(device), acpi_device_bid(device), > > !device->power.state ? "on" : "off"); > > So if we drop the PREFIX and if some one wants to grep for this fan on/off , then how to do that .. > after removing PREFIX , in dmesg I am getting it as : > [ 2.056204] fan PNP0C0B:00: Fan [FAN0] (off) > [ 2.056225] fan PNP0C0B:01: Fan [FAN1] (off) > [ 2.056245] fan PNP0C0B:02: Fan [FAN2] (off) > [ 2.056263] fan PNP0C0B:03: Fan [FAN3] (off) > [ 2.056283] fan PNP0C0B:04: Fan [FAN4] (off) $ dmesg | grep fan ? You can simply say "ACPI fan [%s] (%s)\n", acpi_device_bid(device) " in that dev_info too. Rafael ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] acpi: fan.c: printk replacement 2014-08-27 23:26 ` Rafael J. Wysocki @ 2014-08-28 12:29 ` Sudip Mukherjee 0 siblings, 0 replies; 9+ messages in thread From: Sudip Mukherjee @ 2014-08-28 12:29 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Joe Perches, Zhang Rui, Len Brown, linux-acpi, linux-kernel On Thu, Aug 28, 2014 at 01:26:58AM +0200, Rafael J. Wysocki wrote: > On Wednesday, August 27, 2014 10:27:47 AM Sudip Mukherjee wrote: > > On Tue, Aug 26, 2014 at 11:22:12PM +0200, Rafael J. Wysocki wrote: > > > On Tuesday, August 26, 2014 01:59:02 PM Joe Perches wrote: > > > > On Tue, 2014-08-26 at 23:02 +0200, Rafael J. Wysocki wrote: > > > > > On Tuesday, August 26, 2014 09:00:39 PM Sudip Mukherjee wrote: > > > > > > On Tue, Aug 26, 2014 at 12:45:20AM +0200, Rafael J. Wysocki wrote: > > > > > > > On Friday, August 22, 2014 05:33:21 PM Sudip Mukherjee wrote: > > > > > > > > printk replaced with corresponding dev_err and dev_info > > > > > > > > fixed one broken user-visible string > > > > > > > > multiine comment edited for correct commenting style > > > > > > > > asm/uaccess.h replaced with linux/uaccess.h > > > > > > > > > > > > > > > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> > > > > > > > > --- > > > > > > > > drivers/acpi/fan.c | 18 +++++++++--------- > > > > > > > > 1 file changed, 9 insertions(+), 9 deletions(-) > > > > > > > > > > > > > > > > diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c > > > > > > > > index 8acf53e..7900d55 100644 > > > > > > > > --- a/drivers/acpi/fan.c > > > > > > > > +++ b/drivers/acpi/fan.c > > > > > > > > @@ -27,7 +27,7 @@ > > > > > > > > #include <linux/module.h> > > > > > > > > #include <linux/init.h> > > > > > > > > #include <linux/types.h> > > > > > > > > -#include <asm/uaccess.h> > > > > > > > > +#include <linux/uaccess.h> > > > > > > > > #include <linux/thermal.h> > > > > > > > > #include <linux/acpi.h> > > > > > > > > > > > > > > > > @@ -127,8 +127,9 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { > > > > > > > > }; > > > > > > > > > > > > > > > > /* -------------------------------------------------------------------------- > > > > > > > > - Driver Interface > > > > > > > > - -------------------------------------------------------------------------- */ > > > > > > > > + * Driver Interface > > > > > > > > + * -------------------------------------------------------------------------- > > > > > > > > +*/ > > > > > > > > > > > > > > > > static int acpi_fan_add(struct acpi_device *device) > > > > > > > > { > > > > > > > > @@ -143,7 +144,7 @@ static int acpi_fan_add(struct acpi_device *device) > > > > > > > > > > > > > > > > result = acpi_bus_update_power(device->handle, NULL); > > > > > > > > if (result) { > > > > > > > > - printk(KERN_ERR PREFIX "Setting initial power state\n"); > > > > > > > > + dev_err(&device->dev, PREFIX "Setting initial power state\n"); > > > > > > > > > > > > > > While at it, please define a proper pr_fmt() for this file and get rid of PREFIX > > > > > > > too. > > > > > > > > > > > > > > Otherwise I don't see a compelling reason to apply this. > > > > > > > > > > > > > > > > > > > Hi, > > > > > > Since in the patch I am not using any pr_* , so I am unable to understand why > > > > > > you are asking for a proper pr_fmt(). > > > > > > > > > > Never mind, I was confused somehow, not exactly sure why. Sorry about that. > > > > > > > > > > > I can get rid of the PREFIX . Then should I use pr_* in the patch instead of dev_* ? > > > > > > My understanding was dev_* is more preffered than pr_*. > > > > > > waiting for your suggestion on this. > > > > > > > > > > Well, that really depends on the particular case. It really is better to use > > > > > dev_err() here, but then PREFIX with it is not really useful, so please just > > > > > drop PREFIX from the new messages. > > > > > > > > PREFIX is "ACPI: " so I think the idea is > > > > to be able to grep for that. > > > > > > I'm not sure how useful that is in this particular case. You can grep for "power > > > state" istead just fine ... > > > > > > Rafael > > > > > > > Then there is one more printk which prints fan state is on or off : > > > > >dev_info(&device->dev, PREFIX "%s [%s] (%s)\n", > > > acpi_device_name(device), acpi_device_bid(device), > > > !device->power.state ? "on" : "off"); > > > > So if we drop the PREFIX and if some one wants to grep for this fan on/off , then how to do that .. > > after removing PREFIX , in dmesg I am getting it as : > > [ 2.056204] fan PNP0C0B:00: Fan [FAN0] (off) > > [ 2.056225] fan PNP0C0B:01: Fan [FAN1] (off) > > [ 2.056245] fan PNP0C0B:02: Fan [FAN2] (off) > > [ 2.056263] fan PNP0C0B:03: Fan [FAN3] (off) > > [ 2.056283] fan PNP0C0B:04: Fan [FAN4] (off) > > $ dmesg | grep fan > > ? > > You can simply say "ACPI fan [%s] (%s)\n", acpi_device_bid(device) " in that > dev_info too. > > Rafael > I was under the impression that grep means using git grep and searching in the kernel code. Anyways, I have sent a modified patch , can you please review it .. thanks sudip ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-08-28 12:30 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-08-22 12:03 [PATCH] acpi: fan.c: printk replacement Sudip Mukherjee 2014-08-25 22:45 ` Rafael J. Wysocki 2014-08-26 15:30 ` Sudip Mukherjee 2014-08-26 21:02 ` Rafael J. Wysocki 2014-08-26 20:59 ` Joe Perches 2014-08-26 21:22 ` Rafael J. Wysocki 2014-08-27 4:57 ` Sudip Mukherjee 2014-08-27 23:26 ` Rafael J. Wysocki 2014-08-28 12:29 ` Sudip Mukherjee
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox