Staging: iio: replace pr_err with dev_err
authorHaneen Mohammed <hamohammed.sa@gmail.com>
Tue, 17 Mar 2015 05:35:41 +0000 (08:35 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Mar 2015 10:16:36 +0000 (11:16 +0100)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/resolver/ad2s1210.c

index b4c14ba5fdee3dca1a2585b43e5858f03b53af5c..1d8c5c0bdc8875afe5f85e54a472bb5c6fa217dc 100644 (file)
@@ -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