Skip to contentSkip to conversation

Staging: replace pr_* with dev_*

PATCH New Haneen Mohammed 1 participant 4 messages Mar 18, 2015

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Staging: replace pr_* with dev_*

dev_* is prefered over pr_* when appropriate device stucture is present. This patch replace pr_err and pr_warn with its dev_ counterpart. Issues found with the help of 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, s2, fld;
@@

struct s {
	...
	struct s2 *fld;
	...
};

@rrr@
identifier rr.s2, fld2;
@@

struct s2 {
	...
	struct device fld2;
	...
};

@@
identifier r.i, r.s, rr.fld, rrr.fld2;
position r.p;
@@

-pr_err@p
+dev_err
(
+ &i->fld->fld2,
...)

Haneen Mohammed (3):
Staging: gdm724x: replace pr_* with dev_*
Staging: media: replace pr_* with dev_*
Staging: iio: replace pr_* with dev_*

 drivers/staging/gdm724x/gdm_mux.c                  | 4 ++--
 drivers/staging/gdm724x/gdm_usb.c                  | 7 ++++---
 drivers/staging/iio/resolver/ad2s1210.c            | 6 +++---
 drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 2 +-
 drivers/staging/media/lirc/lirc_sasem.c            | 9 ++++++---
 5 files changed, 16 insertions(+), 12 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/3 Staging: gdm724x: replace pr_* with dev_*

This patch replace pr_err/pr_info with dev_err/dev_info, when appropriate device structure is found.

Issue found and resolved using the following Coccinelle script. pr_err/dev_err was substituted with pr_info/dev_info in the later case.

@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, s2, fld;
@@

struct s {
	...
	struct s2 *fld;
	...
};

@rrr@
identifier rr.s2, fld2;
@@

struct s2 {
	...
	struct device fld2;
	...
};

@@
identifier r.i, r.s, rr.fld, rrr.fld2;
position r.p;
@@

-pr_err@p
+dev_err
(
+ &i->fld->fld2,
...)

---
 drivers/staging/gdm724x/gdm_mux.c | 4 ++--
 drivers/staging/gdm724x/gdm_usb.c | 7 ++++---
 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/staging/gdm724x/gdm_mux.c +2 -2
index b987ba0..8199b0a 100644
@@ -270,7 +270,7 @@ static void gdm_mux_rcv_complete(struct urb *urb)
 
 	if (urb->status) {
 		if (mux_dev->usb_state == PM_NORMAL)
-			pr_err("%s: urb status error %d\n",
+			dev_err(&urb->dev->dev, "%s: urb status error %d\n",
 			       __func__, urb->status);
 		put_rx_struct(rx, r);
 	} else {
@@ -342,7 +342,7 @@ static void gdm_mux_send_complete(struct urb *urb)
 	struct mux_tx *t = urb->context;
 
 	if (urb->status == -ECONNRESET) {
-		pr_info("CONNRESET\n");
+		dev_info(&urb->dev->dev, "CONNRESET\n");
 		free_mux_tx(t);
 		return;
 	}
drivers/staging/gdm724x/gdm_usb.c +4 -3
index d59810f..ed1a12f 100644
@@ -480,7 +480,7 @@ static void gdm_usb_rcv_complete(struct urb *urb)
 		spin_unlock_irqrestore(&rx->to_host_lock, flags);
 	} else {
 		if (urb->status && udev->usb_state == PM_NORMAL)
-			pr_err("%s: urb status error %d\n",
+			dev_err(&urb->dev->dev, "%s: urb status error %d\n",
 			       __func__, urb->status);
 
 		put_rx_struct(rx, r);
@@ -557,7 +557,7 @@ static void gdm_usb_send_complete(struct urb *urb)
 	unsigned long flags;
 
 	if (urb->status == -ECONNRESET) {
-		pr_info("CONNRESET\n");
+		dev_info(&urb->dev->dev, "CONNRESET\n");
 		return;
 	}
 
@@ -590,7 +590,8 @@ static int send_tx_packet(struct usb_device *usbdev, struct usb_tx *t, u32 len)
 	ret = usb_submit_urb(t->urb, GFP_ATOMIC);
 
 	if (ret)
-		pr_err("usb_submit_urb failed: %d\n", ret);
+		dev_err(&usbdev->dev, "usb_submit_urb failed: %d\n",
+			ret);
 
 	usb_mark_last_busy(usbdev);
 
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/3 Staging: media: replace pr_* with dev_*

In reply to Haneen Mohammed

This patch replace pr_err/pr_info with dev_err/dev_infi, when appropriate device structure is found.

Issues found using the following Coccinelle script. pr_err/dev_err was substituted with pr_info/dev_info in the later case.

@r exists@
identifier f, s, i;
position p;
@@
f(...,struct s *i,...) {
<+...
when != i == NULL
pr_err@p(...);
...+>
}
@rr@
identifier r.s, s2, fld;
@@

struct s {
	...
	struct s2 *fld;
	...
};

@rrr@
identifier rr.s2, fld2;
@@

struct s2 {
	...
	struct device fld2;
	...
};

@@
identifier r.i, r.s, rr.fld, rrr.fld2;
position r.p;
@@

-pr_err@p
+dev_err
(
+ &i->fld->fld2,
...)

---
 drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 2 +-
 drivers/staging/media/lirc/lirc_sasem.c            | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/staging/media/davinci_vpfe/dm365_ipipeif.c +1 -1
index ceeef18..17e105e 100644
@@ -209,7 +209,7 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd)
 	/* Combine all the fields to make CFG1 register of IPIPEIF */
 	tmp = val = get_oneshot_mode(ipipeif->input);
 	if (tmp < 0) {
-		pr_err("ipipeif: links setup required");
+		dev_err(&sd->devnode->dev, "ipipeif: links setup required");
 		return -EINVAL;
 	}
 	val <<= ONESHOT_SHIFT;
drivers/staging/media/lirc/lirc_sasem.c +6 -3
index 9944af1..8ba8311 100644
@@ -172,7 +172,8 @@ static void delete_context(struct sasem_context *context)
 	kfree(context);
 
 	if (debug)
-		pr_info("%s: context deleted\n", __func__);
+		dev_info(&context->dev->dev, "%s: context deleted\n",
+			 __func__);
 }
 
 static void deregister_from_lirc(struct sasem_context *context)
@@ -182,10 +183,12 @@ static void deregister_from_lirc(struct sasem_context *context)
 
 	retval = lirc_unregister_driver(minor);
 	if (retval)
-		pr_err("%s: unable to deregister from lirc (%d)\n",
+		dev_err(&context->dev->dev,
+			"%s: unable to deregister from lirc (%d)\n",
 		       __func__, retval);
 	else
-		pr_info("Deregistered Sasem driver (minor:%d)\n", minor);
+		dev_info(&context->dev->dev,
+		         "Deregistered Sasem driver (minor:%d)\n", minor);
 
 }
 
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/3 Staging: iio: replace pr_* with dev_*

In reply to Haneen Mohammed

dev_* is prefered over pr_* when appropriate device stuct is present. This patch replace pr_err and pr_warn with its dev_ counterpart.

---
 drivers/staging/iio/resolver/ad2s1210.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/resolver/ad2s1210.c +3 -3
index 1d8c5c0..5b1daea 100644
@@ -151,7 +151,7 @@ int ad2s1210_update_frequency_control_word(struct ad2s1210_state *st)
 
 	fcw = (unsigned char)(st->fexcit * (1 << 15) / st->fclkin);
 	if (fcw < AD2S1210_MIN_FCW || fcw > AD2S1210_MAX_FCW) {
-		pr_err("ad2s1210: FCW out of range\n");
+		dev_err(&st->sdev->dev, "ad2s1210: FCW out of range\n");
 		return -ERANGE;
 	}
 
@@ -317,7 +317,7 @@ static ssize_t ad2s1210_store_control(struct device *dev,
 	if (st->pdata->gpioin) {
 		data = ad2s1210_read_resolution_pin(st);
 		if (data != st->resolution)
-			pr_warn("ad2s1210: resolution settings not match\n");
+			dev_warn(dev, "ad2s1210: resolution settings not match\n");
 	} else
 		ad2s1210_set_resolution_pin(st);
 
@@ -378,7 +378,7 @@ static ssize_t ad2s1210_store_resolution(struct device *dev,
 	if (st->pdata->gpioin) {
 		data = ad2s1210_read_resolution_pin(st);
 		if (data != st->resolution)
-			pr_warn("ad2s1210: resolution settings not match\n");
+			dev_warn(dev, "ad2s1210: resolution settings not match\n");
 	} else
 		ad2s1210_set_resolution_pin(st);
 	ret = len;
Signature · 1 line
1.9.1