Skip to contentSkip to conversation

Staging: dgnc: Replace printk with pr_err

PATCH In review Helen Fornazier 2 participants 4 messages Mar 26, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: dgnc: Replace printk with pr_err

This patch fixes the following checkpatch.pl warning:

WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "DGNC: sysfs driver_create_file failed!\n");

---
 drivers/staging/dgnc/dgnc_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/dgnc/dgnc_sysfs.c +1 -1
index 2df889e..65551d1 100644
@@ -75,7 +75,7 @@ void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver)
 	rc |= driver_create_file(driverfs, &driver_attr_maxboards);
 	rc |= driver_create_file(driverfs, &driver_attr_pollrate);
 	if (rc)
-		printk(KERN_ERR "DGNC: sysfs driver_create_file failed!\n");
+		pr_err("DGNC: sysfs driver_create_file failed!\n");
 }
 
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 15 lines · Helen Fornazier

This patch fixes the following checkpatch.pl warning:

WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "DGNC: sysfs driver_create_file failed!\n");

---
 drivers/staging/dgnc/dgnc_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/dgnc/dgnc_sysfs.c +0 -0
index 2df889e..65551d1 100644

drivers/staging/dgnc/dgnc_sysfs.c void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver) · line 78

Quoted 5 lines
drivers/staging/dgnc/dgnc_sysfs.c +1 -1
@@ -75,7 +75,7 @@ void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver)
 	rc |= driver_create_file(driverfs, &driver_attr_maxboards);
 	rc |= driver_create_file(driverfs, &driver_attr_pollrate);
 	if (rc)
-		printk(KERN_ERR "DGNC: sysfs driver_create_file failed!\n");
+		pr_err("DGNC: sysfs driver_create_file failed!\n");

The dgnc_driver should give you access to a device-typed field so you can use dev_err.

julia

Quoted 13 lines
drivers/staging/dgnc/dgnc_sysfs.c +0 -0
 }
 
 
Signature · 8 lines
1.9.1

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1427328593-6576-1-git-send-email-helen.fornazier%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
#2 lore raw
Quoted 27 lines · Julia Lawall
Quoted 3 lines · Helen Fornazier

This patch fixes the following checkpatch.pl warning:

WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then

dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

Quoted 1 line

+ printk(KERN_ERR "DGNC: sysfs driver_create_file

failed!\n");

Review

Quoted 7 lines
---
 drivers/staging/dgnc/dgnc_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/dgnc/dgnc_sysfs.c

drivers/staging/dgnc/dgnc_sysfs.c void dgnc_create_driver_sysfiles(struct pci_driver

Quoted 4 lines

index 2df889e..65551d1 100644

drivers/staging/dgnc/dgnc_sysfs.c +0 -0
@@ -75,7 +75,7 @@ void dgnc_create_driver_sysfiles(struct pci_driver

*dgnc_driver)

drivers/staging/dgnc/dgnc_sysfs.c void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver)

Quoted 4 lines
drivers/staging/dgnc/dgnc_sysfs.c +0 -1
      rc |= driver_create_file(driverfs, &driver_attr_maxboards);
      rc |= driver_create_file(driverfs, &driver_attr_pollrate);
      if (rc)
-             printk(KERN_ERR "DGNC: sysfs driver_create_file
Quoted 9 lines

failed!\n");

drivers/staging/dgnc/dgnc_sysfs.c void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver) · line 78

Quoted 1 line
drivers/staging/dgnc/dgnc_sysfs.c +1 -0
+             pr_err("DGNC: sysfs driver_create_file failed!\n");

The dgnc_driver should give you access to a device-typed field so you can use dev_err.

julia

I though about that and I saw that other parts of the code uses dev_err, but inside the dgnc_create_driver_sysfiles function I couldn't figure it out how to get the "structure device" object to use inside the dev_err function.

Quoted 18 lines
Quoted 8 lines
drivers/staging/dgnc/dgnc_sysfs.c +0 -1
 }
 
 
--

1.9.1

--
You received this message because you are subscribed to the Google

Groups "outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected].

Quoted 2 lines

To post to this group, send email to [email protected]. To view this discussion on the web visit

https://groups.google.com/d/msgid/outreachy-kernel/1427328593-6576-1-git-send-email-helen.fornazier%40gmail.com
.

Quoted 2 lines

For more options, visit https://groups.google.com/d/optout.

Signature · 1 line
Helen Fornazier
#3 lore raw
Quoted 36 lines · Helen Fornazier

On Thu, Mar 26, 2015 at 3:31 AM, Julia Lawall <[email protected]> wrote:

      On Wed, 25 Mar 2015, Helen Fornazier wrote:

      > This patch fixes the following checkpatch.pl warning:
      >
      > WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ...
      then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
      > +               printk(KERN_ERR "DGNC: sysfs
      driver_create_file failed!\n");
      >
      > Signed-off-by: Helen Fornazier <[email protected]>
      > ---
      >  drivers/staging/dgnc/dgnc_sysfs.c | 2 +-
      >  1 file changed, 1 insertion(+), 1 deletion(-)
      >
      > diff --git a/drivers/staging/dgnc/dgnc_sysfs.c
      b/drivers/staging/dgnc/dgnc_sysfs.c
      > index 2df889e..65551d1 100644
      > --- a/drivers/staging/dgnc/dgnc_sysfs.c
      > +++ b/drivers/staging/dgnc/dgnc_sysfs.c
      > @@ -75,7 +75,7 @@ void dgnc_create_driver_sysfiles(struct
      pci_driver *dgnc_driver)
      >       rc |= driver_create_file(driverfs,
      &driver_attr_maxboards);
      >       rc |= driver_create_file(driverfs,
      &driver_attr_pollrate);
      >       if (rc)
      > -             printk(KERN_ERR "DGNC: sysfs driver_create_file
      failed!\n");
      > +             pr_err("DGNC: sysfs driver_create_file
      failed!\n");
Quoted 3 lines

The dgnc_driver should give you access to a device-typed field so you can
use dev_err.

Ah, indeed it does not seem to be possible. In another case, Greg suggested to add an argument with the device information. I see that some functions in the same file have struct device *p. Perhaps that is possible here too, if you can change all the call sites.

julia

Quoted 44 lines

julia

I though about that and I saw that other parts of the code uses dev_err, but inside the dgnc_create_driver_sysfiles function I couldn't figure it out how to get the "structure device" object to use inside the dev_err function.

      >  }
      >
      >
      > --
      > 1.9.1
      >
      > --
      > You received this message because you are subscribed to the
      Google Groups "outreachy-kernel" group.
      > To unsubscribe from this group and stop receiving emails from
      it, send an email to
      [email protected].
      > To post to this group, send email to
      [email protected].
      > To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/1427328593-6576-1-git-se
      nd-email-helen.fornazier%40gmail.com.
      > For more options, visit https://groups.google.com/d/optout.
      >

--
Helen Fornazier

--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/CAPW4XYbbeESj6tyXdzXp4pv c%3DgRr-7DShOrfXYns4Y6KB5YRJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.