[media] media: i2c: remove duplicate checks for EPERM in dbg_g/s_register
authorLad, Prabhakar <prabhakar.csengg@gmail.com>
Tue, 14 May 2013 04:45:14 +0000 (01:45 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 27 May 2013 12:34:06 +0000 (09:34 -0300)
This patch removes check for EPERM in dbg_g/s_register of subdevice
drivers as this check is already performed by core.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
17 files changed:
drivers/media/i2c/ad9389b.c
drivers/media/i2c/adv7183.c
drivers/media/i2c/adv7604.c
drivers/media/i2c/cs5345.c
drivers/media/i2c/cx25840/cx25840-core.c
drivers/media/i2c/m52790.c
drivers/media/i2c/mt9v011.c
drivers/media/i2c/ov7670.c
drivers/media/i2c/saa7115.c
drivers/media/i2c/saa7127.c
drivers/media/i2c/saa717x.c
drivers/media/i2c/ths7303.c
drivers/media/i2c/tvp5150.c
drivers/media/i2c/tvp7002.c
drivers/media/i2c/upd64031a.c
drivers/media/i2c/upd64083.c
drivers/media/i2c/vs6624.c

index 1d4e4e70e8f844d68bec49347a87b866d4d8043e..ade1fec7e0400b9de6f4d93e26dcbd6372ceeb6f 100644 (file)
@@ -347,8 +347,6 @@ static int ad9389b_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        reg->val = ad9389b_rd(sd, reg->reg & 0xff);
        reg->size = 1;
        return 0;
@@ -360,8 +358,6 @@ static int ad9389b_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        ad9389b_wr(sd, reg->reg & 0xff, reg->val & 0xff);
        return 0;
 }
index 42b2dec4ca3ae8b836c371f5bd9a195e51b14392..7c48e22b41a239440aff332e903289c6fb796f5d 100644 (file)
@@ -500,8 +500,6 @@ static int adv7183_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        reg->val = adv7183_read(sd, reg->reg & 0xff);
        reg->size = 1;
        return 0;
@@ -513,8 +511,6 @@ static int adv7183_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        adv7183_write(sd, reg->reg & 0xff, reg->val & 0xff);
        return 0;
 }
index 4cdcfc96aa5624ace01c4057ec433fb7275a554b..5528cd15cc676fd2176f96d535254e052b67569e 100644 (file)
@@ -647,8 +647,6 @@ static int adv7604_g_register(struct v4l2_subdev *sd,
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        reg->size = 1;
        switch (reg->reg >> 8) {
        case 0:
@@ -705,8 +703,6 @@ static int adv7604_s_register(struct v4l2_subdev *sd,
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        switch (reg->reg >> 8) {
        case 0:
                io_write(sd, reg->reg & 0xff, reg->val & 0xff);
index 841b9c49dcfaecdade95c7b496ac84378ac57e66..2661757c3a8ce6b516b8c8e8d56331f164edcb78 100644 (file)
@@ -103,8 +103,6 @@ static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *r
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        reg->size = 1;
        reg->val = cs5345_read(sd, reg->reg & 0x1f);
        return 0;
@@ -116,8 +114,6 @@ static int cs5345_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regis
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        cs5345_write(sd, reg->reg & 0x1f, reg->val & 0xff);
        return 0;
 }
index bdfec4c768fe67eef7420862c6ff35c13e2aeda1..b81e32f371ae6263e46f9a0507723409c7303579 100644 (file)
@@ -1664,8 +1664,6 @@ static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        reg->size = 1;
        reg->val = cx25840_read(client, reg->reg & 0x0fff);
        return 0;
@@ -1677,8 +1675,6 @@ static int cx25840_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        cx25840_write(client, reg->reg & 0x0fff, reg->val & 0xff);
        return 0;
 }
index 0d153f3b1a5b573788fe6dbfe5761120c6553a8b..3eeb546be6d93d18ceb2c20c3151655a29045212 100644 (file)
@@ -87,8 +87,6 @@ static int m52790_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *r
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        if (reg->reg != 0)
                return -EINVAL;
        reg->size = 1;
@@ -103,8 +101,6 @@ static int m52790_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regis
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        if (reg->reg != 0)
                return -EINVAL;
        state->input = reg->val & 0x0303;
index c64c9d9e253d46de33f8f96ab14c229a191712a1..141919bf77fc1b74e4b188a4ec451330f0684e25 100644 (file)
@@ -411,8 +411,6 @@ static int mt9v011_g_register(struct v4l2_subdev *sd,
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
 
        reg->val = mt9v011_read(sd, reg->reg & 0xff);
        reg->size = 2;
@@ -427,8 +425,6 @@ static int mt9v011_s_register(struct v4l2_subdev *sd,
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
 
        mt9v011_write(sd, reg->reg & 0xff, reg->val & 0xffff);
 
index d71602f4fb436b47c33904602772d9bb9d25b5b2..b030279810d33d77409969a959cd910545c9103b 100644 (file)
@@ -1479,8 +1479,6 @@ static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *r
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        ret = ov7670_read(sd, reg->reg & 0xff, &val);
        reg->val = val;
        reg->size = 1;
@@ -1493,8 +1491,6 @@ static int ov7670_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regis
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        ov7670_write(sd, reg->reg & 0xff, reg->val & 0xff);
        return 0;
 }
index 8316ae448f4c9a777f04cbada3a5d628fc41a67a..18cf0bfaf74363810ce2956034fa0338b837191e 100644 (file)
@@ -1464,8 +1464,6 @@ static int saa711x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        reg->val = saa711x_read(sd, reg->reg & 0xff);
        reg->size = 1;
        return 0;
@@ -1477,8 +1475,6 @@ static int saa711x_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        saa711x_write(sd, reg->reg & 0xff, reg->val & 0xff);
        return 0;
 }
index 9882c83c1c9369c52ba9727bc4ae6c9d065c5a26..d9c388103e7aa0c3a54356e559004eda08610eb4 100644 (file)
@@ -665,8 +665,6 @@ static int saa7127_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        reg->val = saa7127_read(sd, reg->reg & 0xff);
        reg->size = 1;
        return 0;
@@ -678,8 +676,6 @@ static int saa7127_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        saa7127_write(sd, reg->reg & 0xff, reg->val & 0xff);
        return 0;
 }
index 71328109642e15ccef16aa5e2ac18da972c86ed6..330a04c589391b0989296c40cb05c9a37e98907d 100644 (file)
@@ -981,8 +981,6 @@ static int saa717x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        reg->val = saa717x_read(sd, reg->reg);
        reg->size = 1;
        return 0;
@@ -996,8 +994,6 @@ static int saa717x_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        saa717x_write(sd, addr, val);
        return 0;
 }
index c4339556a2eae8cf09d187172d274c42aee3c1f0..65853eea09a19c865a4853bb6a40f04eece3bf2b 100644 (file)
@@ -236,8 +236,6 @@ static int ths7303_g_register(struct v4l2_subdev *sd,
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
 
        reg->size = 1;
        reg->val = ths7303_read(sd, reg->reg);
@@ -251,8 +249,6 @@ static int ths7303_s_register(struct v4l2_subdev *sd,
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
 
        ths7303_write(sd, reg->reg, reg->val);
        return 0;
index de9db3bf1ebd0febcde8c38893912eaa4a65c8b3..b3cf26628c09a8a443b6387185639b4b68fd9677 100644 (file)
@@ -1054,8 +1054,6 @@ static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        res = tvp5150_read(sd, reg->reg & 0xff);
        if (res < 0) {
                v4l2_err(sd, "%s: failed with error = %d\n", __func__, res);
@@ -1073,8 +1071,6 @@ static int tvp5150_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        tvp5150_write(sd, reg->reg & 0xff, reg->val & 0xff);
        return 0;
 }
index 81b4eb40d7a6114de7c25b0b1557f690bdf70fd4..f339e6faca90ade8c71bd32abca75fe18f265535 100644 (file)
@@ -736,8 +736,7 @@ static int tvp7002_query_dv_timings(struct v4l2_subdev *sd,
  *
  * Get the value of a TVP7002 decoder device register.
  * Returns zero when successful, -EINVAL if register read fails or
- * access to I2C client fails, -EPERM if the call is not allowed
- * by disabled CAP_SYS_ADMIN.
+ * access to I2C client fails.
  */
 static int tvp7002_g_register(struct v4l2_subdev *sd,
                                                struct v4l2_dbg_register *reg)
@@ -748,8 +747,6 @@ static int tvp7002_g_register(struct v4l2_subdev *sd,
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
 
        ret = tvp7002_read(sd, reg->reg & 0xff, &val);
        reg->val = val;
@@ -762,8 +759,7 @@ static int tvp7002_g_register(struct v4l2_subdev *sd,
  * @reg: ptr to v4l2_dbg_register struct
  *
  * Get the value of a TVP7002 decoder device register.
- * Returns zero when successful, -EINVAL if register read fails or
- * -EPERM if call not allowed.
+ * Returns zero when successful, -EINVAL if register read fails.
  */
 static int tvp7002_s_register(struct v4l2_subdev *sd,
                                                const struct v4l2_dbg_register *reg)
@@ -772,8 +768,6 @@ static int tvp7002_s_register(struct v4l2_subdev *sd,
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
 
        return tvp7002_write(sd, reg->reg & 0xff, reg->val & 0xff);
 }
index 4283fc5f39ef2c30e62279915e8156e3adf356ad..13a4cf8bebdfa177392928af61c1d5cc7699cd49 100644 (file)
@@ -168,8 +168,6 @@ static int upd64031a_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        reg->val = upd64031a_read(sd, reg->reg & 0xff);
        reg->size = 1;
        return 0;
@@ -181,8 +179,6 @@ static int upd64031a_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_re
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        upd64031a_write(sd, reg->reg & 0xff, reg->val & 0xff);
        return 0;
 }
index b2ac56ca22e6403c5a8cfc71c7f62123429a6b74..e296639ab90e912fb54e23ec7b74acd16b808783 100644 (file)
@@ -126,8 +126,6 @@ static int upd64083_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        reg->val = upd64083_read(sd, reg->reg & 0xff);
        reg->size = 1;
        return 0;
@@ -139,8 +137,6 @@ static int upd64083_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_reg
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        upd64083_write(sd, reg->reg & 0xff, reg->val & 0xff);
        return 0;
 }
index 7b55b3ddd80f60dd78fc8344386822201ce43c26..d2209a35c510ed2b4102a691012e6fe30474b525 100644 (file)
@@ -741,8 +741,6 @@ static int vs6624_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *r
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        reg->val = vs6624_read(sd, reg->reg & 0xffff);
        reg->size = 1;
        return 0;
@@ -754,8 +752,6 @@ static int vs6624_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regis
 
        if (!v4l2_chip_match_i2c_client(client, &reg->match))
                return -EINVAL;
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
        vs6624_write(sd, reg->reg & 0xffff, reg->val & 0xff);
        return 0;
 }