* [PATCH 0/4] Staging: replace pr_err with dev_err
@ 2015-03-17 5:30 Haneen Mohammed
2015-03-17 5:33 ` [PATCH 1/4] Staging: comedi: " Haneen Mohammed
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Haneen Mohammed @ 2015-03-17 5:30 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Haneen Mohammed
This patchset replace pr_err with dev_err, when appropriate device structure is found.
Issues found using the following Coccinelle script:
@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, fld;
@@
struct s {
...
struct device *fld;
...
};
@@
identifier r.i, rr.fld;
position r.p;
@@
-pr_err@p
+dev_err
(
+ i->fld,
...)
Haneen Mohammed (4):
Staging: comedi: replace pr_err with dev_err
Staging: gdm724x: replace pr_err with dev_err
Staging: iio: replace pr_err with dev_err
Staging: ft1000: replace pr_err with dev_err
drivers/staging/comedi/comedi_fops.c | 6 ++++--
drivers/staging/ft1000/ft1000-usb/ft1000_usb.c | 5 +++--
drivers/staging/gdm724x/gdm_mux.c | 4 ++--
drivers/staging/gdm724x/gdm_usb.c | 8 ++++----
drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++-----
5 files changed, 20 insertions(+), 15 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] Staging: comedi: replace pr_err with dev_err
2015-03-17 5:30 [PATCH 0/4] Staging: replace pr_err with dev_err Haneen Mohammed
@ 2015-03-17 5:33 ` Haneen Mohammed
2015-03-17 5:34 ` [PATCH 2/4] Staging: gdm724x: " Haneen Mohammed
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Haneen Mohammed @ 2015-03-17 5:33 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Haneen Mohammed
This patch replace pr_err with dev_err, when appropriate device
structure is found.
Issue found using the following Coccinelle script:
@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, fld;
@@
struct s {
...
struct device *fld;
...
};
@@
identifier r.i, rr.fld;
position r.p;
@@
-pr_err@p
+dev_err
(
+ i->fld,
...)
Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
---
drivers/staging/comedi/comedi_fops.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 2f8257c..8bf57b7 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -2700,7 +2700,8 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device)
mutex_unlock(&dev->mutex);
comedi_device_cleanup(dev);
comedi_dev_put(dev);
- pr_err("ran out of minor numbers for board device files\n");
+ dev_err(hardware_device,
+ "ran out of minor numbers for board device files\n");
return ERR_PTR(-EBUSY);
}
dev->minor = i;
@@ -2753,7 +2754,8 @@ int comedi_alloc_subdevice_minor(struct comedi_subdevice *s)
}
mutex_unlock(&comedi_subdevice_minor_table_lock);
if (i == COMEDI_NUM_SUBDEVICE_MINORS) {
- pr_err("ran out of minor numbers for subdevice files\n");
+ dev_err(dev->class_dev,
+ "ran out of minor numbers for subdevice files\n");
return -EBUSY;
}
i += COMEDI_NUM_BOARD_MINORS;
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] Staging: gdm724x: replace pr_err with dev_err
2015-03-17 5:30 [PATCH 0/4] Staging: replace pr_err with dev_err Haneen Mohammed
2015-03-17 5:33 ` [PATCH 1/4] Staging: comedi: " Haneen Mohammed
@ 2015-03-17 5:34 ` Haneen Mohammed
2015-03-17 5:35 ` [PATCH 3/4] Staging: iio: " Haneen Mohammed
2015-03-17 5:37 ` [PATCH 4/4] Staging: ft1000: " Haneen Mohammed
3 siblings, 0 replies; 10+ messages in thread
From: Haneen Mohammed @ 2015-03-17 5:34 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Haneen Mohammed
This patch replace pr_err with dev_err, when appropriate device structre
is found.
Issue found using the following Coccinelle script:
@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, fld;
@@
struct s {
...
struct device *fld;
...
};
@@
identifier r.i, rr.fld;
position r.p;
@@
-pr_err@p
+dev_err
(
+ i->fld,
...)
Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
---
drivers/staging/gdm724x/gdm_mux.c | 4 ++--
drivers/staging/gdm724x/gdm_usb.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/gdm724x/gdm_mux.c b/drivers/staging/gdm724x/gdm_mux.c
index d1ab996..b987ba0 100644
--- a/drivers/staging/gdm724x/gdm_mux.c
+++ b/drivers/staging/gdm724x/gdm_mux.c
@@ -608,7 +608,7 @@ static int gdm_mux_suspend(struct usb_interface *intf, pm_message_t pm_msg)
rx = &mux_dev->rx;
if (mux_dev->usb_state != PM_NORMAL) {
- pr_err("usb suspend - invalid state\n");
+ dev_err(intf->usb_dev, "usb suspend - invalid state\n");
return -1;
}
@@ -637,7 +637,7 @@ static int gdm_mux_resume(struct usb_interface *intf)
mux_dev = tty_dev->priv_dev;
if (mux_dev->usb_state != PM_SUSPEND) {
- pr_err("usb resume - invalid state\n");
+ dev_err(intf->usb_dev, "usb resume - invalid state\n");
return -1;
}
diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c
index d2a3b35..d59810f 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -848,7 +848,7 @@ static int gdm_usb_probe(struct usb_interface *intf,
udev->usbdev = usbdev;
ret = init_usb(udev);
if (ret < 0) {
- pr_err("init_usb func failed\n");
+ dev_err(intf->usb_dev, "init_usb func failed\n");
goto err_init_usb;
}
udev->intf = intf;
@@ -867,7 +867,7 @@ static int gdm_usb_probe(struct usb_interface *intf,
ret = request_mac_address(udev);
if (ret < 0) {
- pr_err("request Mac address failed\n");
+ dev_err(intf->usb_dev, "request Mac address failed\n");
goto err_mac_address;
}
@@ -928,7 +928,7 @@ static int gdm_usb_suspend(struct usb_interface *intf, pm_message_t pm_msg)
udev = phy_dev->priv_dev;
rx = &udev->rx;
if (udev->usb_state != PM_NORMAL) {
- pr_err("usb suspend - invalid state\n");
+ dev_err(intf->usb_dev, "usb suspend - invalid state\n");
return -1;
}
@@ -961,7 +961,7 @@ static int gdm_usb_resume(struct usb_interface *intf)
rx = &udev->rx;
if (udev->usb_state != PM_SUSPEND) {
- pr_err("usb resume - invalid state\n");
+ dev_err(intf->usb_dev, "usb resume - invalid state\n");
return -1;
}
udev->usb_state = PM_NORMAL;
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] Staging: iio: replace pr_err with dev_err
2015-03-17 5:30 [PATCH 0/4] Staging: replace pr_err with dev_err Haneen Mohammed
2015-03-17 5:33 ` [PATCH 1/4] Staging: comedi: " Haneen Mohammed
2015-03-17 5:34 ` [PATCH 2/4] Staging: gdm724x: " Haneen Mohammed
@ 2015-03-17 5:35 ` Haneen Mohammed
2015-03-17 8:52 ` [Outreachy kernel] " Daniel Baluta
2015-03-17 5:37 ` [PATCH 4/4] Staging: ft1000: " Haneen Mohammed
3 siblings, 1 reply; 10+ messages in thread
From: Haneen Mohammed @ 2015-03-17 5:35 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Haneen Mohammed
This patch replace pr_err with dev_err, when appropriate device structre
is found.
Issue found using the following Coccinelle script:
@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, fld;
@@
struct s {
...
struct device *fld;
...
};
@@
identifier r.i, rr.fld;
position r.p;
@@
-pr_err@p
+dev_err
(
+ i->fld,
...)
Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
---
drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index b4c14ba..1d8c5c0 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -214,7 +214,7 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev,
if (ret)
return ret;
if (fclkin < AD2S1210_MIN_CLKIN || fclkin > AD2S1210_MAX_CLKIN) {
- pr_err("ad2s1210: fclkin out of range\n");
+ dev_err(dev, "ad2s1210: fclkin out of range\n");
return -EINVAL;
}
@@ -252,7 +252,8 @@ static ssize_t ad2s1210_store_fexcit(struct device *dev,
if (ret < 0)
return ret;
if (fexcit < AD2S1210_MIN_EXCIT || fexcit > AD2S1210_MAX_EXCIT) {
- pr_err("ad2s1210: excitation frequency out of range\n");
+ dev_err(dev,
+ "ad2s1210: excitation frequency out of range\n");
return -EINVAL;
}
mutex_lock(&st->lock);
@@ -307,7 +308,8 @@ static ssize_t ad2s1210_store_control(struct device *dev,
goto error_ret;
if (ret & AD2S1210_MSB_IS_HIGH) {
ret = -EIO;
- pr_err("ad2s1210: write control register fail\n");
+ dev_err(dev,
+ "ad2s1210: write control register fail\n");
goto error_ret;
}
st->resolution
@@ -346,7 +348,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev,
ret = kstrtou8(buf, 10, &udata);
if (ret || udata < 10 || udata > 16) {
- pr_err("ad2s1210: resolution out of range\n");
+ dev_err(dev, "ad2s1210: resolution out of range\n");
return -EINVAL;
}
mutex_lock(&st->lock);
@@ -368,7 +370,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev,
data = ret;
if (data & AD2S1210_MSB_IS_HIGH) {
ret = -EIO;
- pr_err("ad2s1210: setting resolution fail\n");
+ dev_err(dev, "ad2s1210: setting resolution fail\n");
goto error_ret;
}
st->resolution
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] Staging: ft1000: replace pr_err with dev_err
2015-03-17 5:30 [PATCH 0/4] Staging: replace pr_err with dev_err Haneen Mohammed
` (2 preceding siblings ...)
2015-03-17 5:35 ` [PATCH 3/4] Staging: iio: " Haneen Mohammed
@ 2015-03-17 5:37 ` Haneen Mohammed
2015-03-17 8:37 ` [Outreachy kernel] " Julia Lawall
3 siblings, 1 reply; 10+ messages in thread
From: Haneen Mohammed @ 2015-03-17 5:37 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Haneen Mohammed
This patch replace pr_err with dev_err, when appropriate device
structure is found.
Issue found using the following Coccinelle script:
@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, fld;
@@
struct s {
...
struct device *fld;
...
};
@@
identifier r.i, rr.fld;
position r.p;
@@
-pr_err@p
+dev_err
(
+ i->fld,
...)
Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
---
drivers/staging/ft1000/ft1000-usb/ft1000_usb.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
index a6b55f4..3b303b6 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
@@ -136,7 +136,7 @@ static int ft1000_probe(struct usb_interface *interface,
ret = request_firmware(&dsp_fw, "ft3000.img", &dev->dev);
if (ret < 0) {
- pr_err("Error request_firmware()\n");
+ dev_err(interface->usb_dev, "Error request_firmware()\n");
goto err_fw;
}
@@ -164,7 +164,8 @@ static int ft1000_probe(struct usb_interface *interface,
pr_debug("pft1000info=%p\n", pft1000info);
ret = dsp_reload(ft1000dev);
if (ret) {
- pr_err("Problem with DSP image loading\n");
+ dev_err(interface->usb_dev,
+ "Problem with DSP image loading\n");
goto err_load;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Outreachy kernel] [PATCH 4/4] Staging: ft1000: replace pr_err with dev_err
2015-03-17 5:37 ` [PATCH 4/4] Staging: ft1000: " Haneen Mohammed
@ 2015-03-17 8:37 ` Julia Lawall
0 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2015-03-17 8:37 UTC (permalink / raw)
To: Haneen Mohammed; +Cc: outreachy-kernel
On Tue, 17 Mar 2015, Haneen Mohammed wrote:
> This patch replace pr_err with dev_err, when appropriate device
> structure is found.
How did you run Coccinelle for this? You may get more results with eg
--all-includes, since structure definitions may be in header files.
julia
> Issue found using the following Coccinelle script:
>
> @r exists@
> identifier f, s, i;
> position p;
> @@
>
> f(...,struct s *i,...) {
> <+...
> when != i == NULL
> pr_err@p(...);
> ...+>
> }
>
> @rr@
> identifier r.s, fld;
> @@
>
> struct s {
> ...
> struct device *fld;
> ...
> };
>
> @@
> identifier r.i, rr.fld;
> position r.p;
> @@
> -pr_err@p
> +dev_err
> (
> + i->fld,
> ...)
>
> Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> ---
> drivers/staging/ft1000/ft1000-usb/ft1000_usb.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
> index a6b55f4..3b303b6 100644
> --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
> +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
> @@ -136,7 +136,7 @@ static int ft1000_probe(struct usb_interface *interface,
>
> ret = request_firmware(&dsp_fw, "ft3000.img", &dev->dev);
> if (ret < 0) {
> - pr_err("Error request_firmware()\n");
> + dev_err(interface->usb_dev, "Error request_firmware()\n");
> goto err_fw;
> }
>
> @@ -164,7 +164,8 @@ static int ft1000_probe(struct usb_interface *interface,
> pr_debug("pft1000info=%p\n", pft1000info);
> ret = dsp_reload(ft1000dev);
> if (ret) {
> - pr_err("Problem with DSP image loading\n");
> + dev_err(interface->usb_dev,
> + "Problem with DSP image loading\n");
> goto err_load;
> }
>
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1426570656-22498-1-git-send-email-hamohammed.sa%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Outreachy kernel] [PATCH 3/4] Staging: iio: replace pr_err with dev_err
2015-03-17 5:35 ` [PATCH 3/4] Staging: iio: " Haneen Mohammed
@ 2015-03-17 8:52 ` Daniel Baluta
2015-03-17 8:54 ` Julia Lawall
0 siblings, 1 reply; 10+ messages in thread
From: Daniel Baluta @ 2015-03-17 8:52 UTC (permalink / raw)
To: Haneen Mohammed; +Cc: outreachy-kernel
On Tue, Mar 17, 2015 at 7:35 AM, Haneen Mohammed
<hamohammed.sa@gmail.com> wrote:
> This patch replace pr_err with dev_err, when appropriate device structre
> is found.
> Issue found using the following Coccinelle script:
>
> @r exists@
> identifier f, s, i;
> position p;
> @@
>
> f(...,struct s *i,...) {
> <+...
> when != i == NULL
> pr_err@p(...);
> ...+>
> }
>
> @rr@
> identifier r.s, fld;
> @@
>
> struct s {
> ...
> struct device *fld;
> ...
> };
>
> @@
> identifier r.i, rr.fld;
> position r.p;
> @@
> -pr_err@p
> +dev_err
> (
> + i->fld,
> ...)
>
> Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Hi Haneen,
There are a lot of other pr_err instances in that file that you can
convert to dev_err.
E.g
ad2s1210_update_frequency_control_word
You could use the st->sdev->dev. This applies for your changes below, too.
> ---
> drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
> index b4c14ba..1d8c5c0 100644
> --- a/drivers/staging/iio/resolver/ad2s1210.c
> +++ b/drivers/staging/iio/resolver/ad2s1210.c
> @@ -214,7 +214,7 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev,
> if (ret)
> return ret;
> if (fclkin < AD2S1210_MIN_CLKIN || fclkin > AD2S1210_MAX_CLKIN) {
> - pr_err("ad2s1210: fclkin out of range\n");
> + dev_err(dev, "ad2s1210: fclkin out of range\n");
> return -EINVAL;
> }
>
> @@ -252,7 +252,8 @@ static ssize_t ad2s1210_store_fexcit(struct device *dev,
> if (ret < 0)
> return ret;
> if (fexcit < AD2S1210_MIN_EXCIT || fexcit > AD2S1210_MAX_EXCIT) {
> - pr_err("ad2s1210: excitation frequency out of range\n");
> + dev_err(dev,
> + "ad2s1210: excitation frequency out of range\n");
> return -EINVAL;
> }
> mutex_lock(&st->lock);
> @@ -307,7 +308,8 @@ static ssize_t ad2s1210_store_control(struct device *dev,
> goto error_ret;
> if (ret & AD2S1210_MSB_IS_HIGH) {
> ret = -EIO;
> - pr_err("ad2s1210: write control register fail\n");
> + dev_err(dev,
> + "ad2s1210: write control register fail\n");
> goto error_ret;
> }
> st->resolution
> @@ -346,7 +348,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev,
>
> ret = kstrtou8(buf, 10, &udata);
> if (ret || udata < 10 || udata > 16) {
> - pr_err("ad2s1210: resolution out of range\n");
> + dev_err(dev, "ad2s1210: resolution out of range\n");
> return -EINVAL;
> }
> mutex_lock(&st->lock);
> @@ -368,7 +370,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev,
> data = ret;
> if (data & AD2S1210_MSB_IS_HIGH) {
> ret = -EIO;
> - pr_err("ad2s1210: setting resolution fail\n");
> + dev_err(dev, "ad2s1210: setting resolution fail\n");
> goto error_ret;
> }
> st->resolution
thanks,
Daniel.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Outreachy kernel] [PATCH 3/4] Staging: iio: replace pr_err with dev_err
2015-03-17 8:52 ` [Outreachy kernel] " Daniel Baluta
@ 2015-03-17 8:54 ` Julia Lawall
2015-03-17 11:10 ` Haneen
0 siblings, 1 reply; 10+ messages in thread
From: Julia Lawall @ 2015-03-17 8:54 UTC (permalink / raw)
To: Daniel Baluta; +Cc: Haneen Mohammed, outreachy-kernel
On Tue, 17 Mar 2015, Daniel Baluta wrote:
> On Tue, Mar 17, 2015 at 7:35 AM, Haneen Mohammed
> <hamohammed.sa@gmail.com> wrote:
> > This patch replace pr_err with dev_err, when appropriate device structre
> > is found.
> > Issue found using the following Coccinelle script:
> >
> > @r exists@
> > identifier f, s, i;
> > position p;
> > @@
> >
> > f(...,struct s *i,...) {
> > <+...
> > when != i == NULL
> > pr_err@p(...);
> > ...+>
> > }
> >
> > @rr@
> > identifier r.s, fld;
> > @@
> >
> > struct s {
> > ...
> > struct device *fld;
> > ...
> > };
> >
> > @@
> > identifier r.i, rr.fld;
> > position r.p;
> > @@
> > -pr_err@p
> > +dev_err
> > (
> > + i->fld,
> > ...)
> >
> > Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
>
> Hi Haneen,
>
> There are a lot of other pr_err instances in that file that you can
> convert to dev_err.
>
> E.g
> ad2s1210_update_frequency_control_word
>
> You could use the st->sdev->dev. This applies for your changes below, too.
Maybe this is related to the lack of --all-includes.
julia
>
>
> > ---
> > drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++-----
> > 1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
> > index b4c14ba..1d8c5c0 100644
> > --- a/drivers/staging/iio/resolver/ad2s1210.c
> > +++ b/drivers/staging/iio/resolver/ad2s1210.c
> > @@ -214,7 +214,7 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev,
> > if (ret)
> > return ret;
> > if (fclkin < AD2S1210_MIN_CLKIN || fclkin > AD2S1210_MAX_CLKIN) {
> > - pr_err("ad2s1210: fclkin out of range\n");
> > + dev_err(dev, "ad2s1210: fclkin out of range\n");
> > return -EINVAL;
> > }
> >
> > @@ -252,7 +252,8 @@ static ssize_t ad2s1210_store_fexcit(struct device *dev,
> > if (ret < 0)
> > return ret;
> > if (fexcit < AD2S1210_MIN_EXCIT || fexcit > AD2S1210_MAX_EXCIT) {
> > - pr_err("ad2s1210: excitation frequency out of range\n");
> > + dev_err(dev,
> > + "ad2s1210: excitation frequency out of range\n");
> > return -EINVAL;
> > }
> > mutex_lock(&st->lock);
> > @@ -307,7 +308,8 @@ static ssize_t ad2s1210_store_control(struct device *dev,
> > goto error_ret;
> > if (ret & AD2S1210_MSB_IS_HIGH) {
> > ret = -EIO;
> > - pr_err("ad2s1210: write control register fail\n");
> > + dev_err(dev,
> > + "ad2s1210: write control register fail\n");
> > goto error_ret;
> > }
> > st->resolution
> > @@ -346,7 +348,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev,
> >
> > ret = kstrtou8(buf, 10, &udata);
> > if (ret || udata < 10 || udata > 16) {
> > - pr_err("ad2s1210: resolution out of range\n");
> > + dev_err(dev, "ad2s1210: resolution out of range\n");
> > return -EINVAL;
> > }
> > mutex_lock(&st->lock);
> > @@ -368,7 +370,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev,
> > data = ret;
> > if (data & AD2S1210_MSB_IS_HIGH) {
> > ret = -EIO;
> > - pr_err("ad2s1210: setting resolution fail\n");
> > + dev_err(dev, "ad2s1210: setting resolution fail\n");
> > goto error_ret;
> > }
> > st->resolution
> thanks,
> Daniel.
>
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAEnQRZA4fAKcA%3DVh5DRCHfh%3DWjB1HnhySffgkgu%2B6-9Qfu6orA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Outreachy kernel] [PATCH 3/4] Staging: iio: replace pr_err with dev_err
2015-03-17 8:54 ` Julia Lawall
@ 2015-03-17 11:10 ` Haneen
2015-03-17 11:20 ` Julia Lawall
0 siblings, 1 reply; 10+ messages in thread
From: Haneen @ 2015-03-17 11:10 UTC (permalink / raw)
To: Julia Lawall, outreachy-kernel
On Tue, Mar 17, 2015 at 09:54:57AM +0100, Julia Lawall wrote:
>
>
> On Tue, 17 Mar 2015, Daniel Baluta wrote:
>
> > On Tue, Mar 17, 2015 at 7:35 AM, Haneen Mohammed
> > <hamohammed.sa@gmail.com> wrote:
> > > This patch replace pr_err with dev_err, when appropriate device structre
> > > is found.
> > > Issue found using the following Coccinelle script:
> > >
> > > @r exists@
> > > identifier f, s, i;
> > > position p;
> > > @@
> > >
> > > f(...,struct s *i,...) {
> > > <+...
> > > when != i == NULL
> > > pr_err@p(...);
> > > ...+>
> > > }
> > >
> > > @rr@
> > > identifier r.s, fld;
> > > @@
> > >
> > > struct s {
> > > ...
> > > struct device *fld;
> > > ...
> > > };
> > >
> > > @@
> > > identifier r.i, rr.fld;
> > > position r.p;
> > > @@
> > > -pr_err@p
> > > +dev_err
> > > (
> > > + i->fld,
> > > ...)
> > >
> > > Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> >
> > Hi Haneen,
> >
> > There are a lot of other pr_err instances in that file that you can
> > convert to dev_err.
> >
> > E.g
> > ad2s1210_update_frequency_control_word
> >
> > You could use the st->sdev->dev. This applies for your changes below, too.
>
> Maybe this is related to the lack of --all-includes.
>
> julia
>
I did use --all-includes :) this is what I used:
$ spatch --sp-file ../pr3.cocci --all-includes -I include/ --dir
drivers/staging/ > ../pr4.out
This was hinted in this video, becuase without it I didn't get any
result:
https://www.youtube.com/watch?v=4uhHhKTOHDs
But I think I need to refine the script to include other cases.
Also, I needed to manulaly adjust some of the outputs such as when the
device struct is what was passed in the function, becuase for that I got
the following in comedi/comedi_fops.c:
dev_err(hardware_device->parent,
"ran out of minor numbers for board device
files\n");
And I got two outputs that I couldn't confirm if there were a device
struct, such as "dev_err(port->dev," from panel/panel.c file and
dev_err(mc_io->dev, from fsl-mc/bus/mc-bus.c
> >
> >
> > > ---
> > > drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++-----
> > > 1 file changed, 7 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
> > > index b4c14ba..1d8c5c0 100644
> > > --- a/drivers/staging/iio/resolver/ad2s1210.c
> > > +++ b/drivers/staging/iio/resolver/ad2s1210.c
> > > @@ -214,7 +214,7 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev,
> > > if (ret)
> > > return ret;
> > > if (fclkin < AD2S1210_MIN_CLKIN || fclkin > AD2S1210_MAX_CLKIN) {
> > > - pr_err("ad2s1210: fclkin out of range\n");
> > > + dev_err(dev, "ad2s1210: fclkin out of range\n");
> > > return -EINVAL;
> > > }
> > >
> > > @@ -252,7 +252,8 @@ static ssize_t ad2s1210_store_fexcit(struct device *dev,
> > > if (ret < 0)
> > > return ret;
> > > if (fexcit < AD2S1210_MIN_EXCIT || fexcit > AD2S1210_MAX_EXCIT) {
> > > - pr_err("ad2s1210: excitation frequency out of range\n");
> > > + dev_err(dev,
> > > + "ad2s1210: excitation frequency out of range\n");
> > > return -EINVAL;
> > > }
> > > mutex_lock(&st->lock);
> > > @@ -307,7 +308,8 @@ static ssize_t ad2s1210_store_control(struct device *dev,
> > > goto error_ret;
> > > if (ret & AD2S1210_MSB_IS_HIGH) {
> > > ret = -EIO;
> > > - pr_err("ad2s1210: write control register fail\n");
> > > + dev_err(dev,
> > > + "ad2s1210: write control register fail\n");
> > > goto error_ret;
> > > }
> > > st->resolution
> > > @@ -346,7 +348,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev,
> > >
> > > ret = kstrtou8(buf, 10, &udata);
> > > if (ret || udata < 10 || udata > 16) {
> > > - pr_err("ad2s1210: resolution out of range\n");
> > > + dev_err(dev, "ad2s1210: resolution out of range\n");
> > > return -EINVAL;
> > > }
> > > mutex_lock(&st->lock);
> > > @@ -368,7 +370,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev,
> > > data = ret;
> > > if (data & AD2S1210_MSB_IS_HIGH) {
> > > ret = -EIO;
> > > - pr_err("ad2s1210: setting resolution fail\n");
> > > + dev_err(dev, "ad2s1210: setting resolution fail\n");
> > > goto error_ret;
> > > }
> > > st->resolution
> > thanks,
> > Daniel.
> >
> > --
> > 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 outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAEnQRZA4fAKcA%3DVh5DRCHfh%3DWjB1HnhySffgkgu%2B6-9Qfu6orA%40mail.gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Outreachy kernel] [PATCH 3/4] Staging: iio: replace pr_err with dev_err
2015-03-17 11:10 ` Haneen
@ 2015-03-17 11:20 ` Julia Lawall
0 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2015-03-17 11:20 UTC (permalink / raw)
To: Haneen; +Cc: outreachy-kernel
On Tue, 17 Mar 2015, Haneen wrote:
> On Tue, Mar 17, 2015 at 09:54:57AM +0100, Julia Lawall wrote:
> >
> >
> > On Tue, 17 Mar 2015, Daniel Baluta wrote:
> >
> > > On Tue, Mar 17, 2015 at 7:35 AM, Haneen Mohammed
> > > <hamohammed.sa@gmail.com> wrote:
> > > > This patch replace pr_err with dev_err, when appropriate device structre
> > > > is found.
> > > > Issue found using the following Coccinelle script:
> > > >
> > > > @r exists@
> > > > identifier f, s, i;
> > > > position p;
> > > > @@
> > > >
> > > > f(...,struct s *i,...) {
> > > > <+...
> > > > when != i == NULL
> > > > pr_err@p(...);
> > > > ...+>
> > > > }
> > > >
> > > > @rr@
> > > > identifier r.s, fld;
> > > > @@
> > > >
> > > > struct s {
> > > > ...
> > > > struct device *fld;
> > > > ...
> > > > };
> > > >
> > > > @@
> > > > identifier r.i, rr.fld;
> > > > position r.p;
> > > > @@
> > > > -pr_err@p
> > > > +dev_err
> > > > (
> > > > + i->fld,
> > > > ...)
> > > >
> > > > Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> > >
> > > Hi Haneen,
> > >
> > > There are a lot of other pr_err instances in that file that you can
> > > convert to dev_err.
> > >
> > > E.g
> > > ad2s1210_update_frequency_control_word
> > >
> > > You could use the st->sdev->dev. This applies for your changes below, too.
> >
> > Maybe this is related to the lack of --all-includes.
> >
> > julia
> >
>
> I did use --all-includes :) this is what I used:
OK, you can try replacing --all-includes with --recursive-includes. That
will include header files that are included by other header files. It
could be slow, though.
In thinking about it, I think that you are right that you should include
more patterns. For your parameter, you have a type, so you need to look
in it for a device strcuture, but if you don't find it, you may want to
look in all other structure typed fields to see if their types have device
structures.
julia
> $ spatch --sp-file ../pr3.cocci --all-includes -I include/ --dir
> drivers/staging/ > ../pr4.out
>
> This was hinted in this video, becuase without it I didn't get any
> result:
> https://www.youtube.com/watch?v=4uhHhKTOHDs
>
> But I think I need to refine the script to include other cases.
> Also, I needed to manulaly adjust some of the outputs such as when the
> device struct is what was passed in the function, becuase for that I got
> the following in comedi/comedi_fops.c:
> dev_err(hardware_device->parent,
> "ran out of minor numbers for board device
> files\n");
>
> And I got two outputs that I couldn't confirm if there were a device
> struct, such as "dev_err(port->dev," from panel/panel.c file and
> dev_err(mc_io->dev, from fsl-mc/bus/mc-bus.c
>
>
> > >
> > >
> > > > ---
> > > > drivers/staging/iio/resolver/ad2s1210.c | 12 +++++++-----
> > > > 1 file changed, 7 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
> > > > index b4c14ba..1d8c5c0 100644
> > > > --- a/drivers/staging/iio/resolver/ad2s1210.c
> > > > +++ b/drivers/staging/iio/resolver/ad2s1210.c
> > > > @@ -214,7 +214,7 @@ static ssize_t ad2s1210_store_fclkin(struct device *dev,
> > > > if (ret)
> > > > return ret;
> > > > if (fclkin < AD2S1210_MIN_CLKIN || fclkin > AD2S1210_MAX_CLKIN) {
> > > > - pr_err("ad2s1210: fclkin out of range\n");
> > > > + dev_err(dev, "ad2s1210: fclkin out of range\n");
> > > > return -EINVAL;
> > > > }
> > > >
> > > > @@ -252,7 +252,8 @@ static ssize_t ad2s1210_store_fexcit(struct device *dev,
> > > > if (ret < 0)
> > > > return ret;
> > > > if (fexcit < AD2S1210_MIN_EXCIT || fexcit > AD2S1210_MAX_EXCIT) {
> > > > - pr_err("ad2s1210: excitation frequency out of range\n");
> > > > + dev_err(dev,
> > > > + "ad2s1210: excitation frequency out of range\n");
> > > > return -EINVAL;
> > > > }
> > > > mutex_lock(&st->lock);
> > > > @@ -307,7 +308,8 @@ static ssize_t ad2s1210_store_control(struct device *dev,
> > > > goto error_ret;
> > > > if (ret & AD2S1210_MSB_IS_HIGH) {
> > > > ret = -EIO;
> > > > - pr_err("ad2s1210: write control register fail\n");
> > > > + dev_err(dev,
> > > > + "ad2s1210: write control register fail\n");
> > > > goto error_ret;
> > > > }
> > > > st->resolution
> > > > @@ -346,7 +348,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev,
> > > >
> > > > ret = kstrtou8(buf, 10, &udata);
> > > > if (ret || udata < 10 || udata > 16) {
> > > > - pr_err("ad2s1210: resolution out of range\n");
> > > > + dev_err(dev, "ad2s1210: resolution out of range\n");
> > > > return -EINVAL;
> > > > }
> > > > mutex_lock(&st->lock);
> > > > @@ -368,7 +370,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev,
> > > > data = ret;
> > > > if (data & AD2S1210_MSB_IS_HIGH) {
> > > > ret = -EIO;
> > > > - pr_err("ad2s1210: setting resolution fail\n");
> > > > + dev_err(dev, "ad2s1210: setting resolution fail\n");
> > > > goto error_ret;
> > > > }
> > > > st->resolution
> > > thanks,
> > > Daniel.
> > >
> > > --
> > > 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 outreachy-kernel+unsubscribe@googlegroups.com.
> > > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAEnQRZA4fAKcA%3DVh5DRCHfh%3DWjB1HnhySffgkgu%2B6-9Qfu6orA%40mail.gmail.com.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
>
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150317111042.GA24753%40haneen-vb.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-03-17 11:20 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17 5:30 [PATCH 0/4] Staging: replace pr_err with dev_err Haneen Mohammed
2015-03-17 5:33 ` [PATCH 1/4] Staging: comedi: " Haneen Mohammed
2015-03-17 5:34 ` [PATCH 2/4] Staging: gdm724x: " Haneen Mohammed
2015-03-17 5:35 ` [PATCH 3/4] Staging: iio: " Haneen Mohammed
2015-03-17 8:52 ` [Outreachy kernel] " Daniel Baluta
2015-03-17 8:54 ` Julia Lawall
2015-03-17 11:10 ` Haneen
2015-03-17 11:20 ` Julia Lawall
2015-03-17 5:37 ` [PATCH 4/4] Staging: ft1000: " Haneen Mohammed
2015-03-17 8:37 ` [Outreachy kernel] " Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.