From patchwork Sun Apr 5 18:03:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 11474799 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6459D14DD for ; Sun, 5 Apr 2020 18:05:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39EE2206F5 for ; Sun, 5 Apr 2020 18:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109945; bh=t9P+pyoUFij+kWGMhTYvvxg/WLmtzDg9rE3VUgRhm2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=O3E1J2r5MTMPD9jmEucCTJbfHOHw8JsEDUNv4zYfCtQ7PoKIcDoDDct+nzv7VO/Ke jesKeGmsT5d24Rg4bA+8a/6DmrAQORZWg+L5+fwZqQ2FNPtm9G+CdnJ9OD2eXFZFRq NeEezlBuQkR9NxASbJWkHt9vgXevOEiqf6Uhqzp4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727444AbgDESFo (ORCPT ); Sun, 5 Apr 2020 14:05:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:54218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726771AbgDESFo (ORCPT ); Sun, 5 Apr 2020 14:05:44 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7E9DB20678; Sun, 5 Apr 2020 18:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109944; bh=t9P+pyoUFij+kWGMhTYvvxg/WLmtzDg9rE3VUgRhm2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M79BDxoVMqNtxlnhxZ9ABH4zs4XihKZMAcJSmBdVz5yRd4GoYB0A31ymutjPQpmwD KRaBJsNMIw6gDTqyzGShFk7fCzyRUi2mO7FyA8vD4hNJXLspTjRKrrGwWSufOB8+f3 LlH2mfDUv5qX9yWX7JJ+s8GCuiW9CYrkEph7RrD0= From: jic23@kernel.org To: linux-iio@vger.kernel.org Cc: Andy Shevchenko , Jonathan Cameron Subject: [PATCH 1/6] iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls Date: Sun, 5 Apr 2020 19:03:16 +0100 Message-Id: <20200405180321.1737310-2-jic23@kernel.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200405180321.1737310-1-jic23@kernel.org> References: <20200405180321.1737310-1-jic23@kernel.org> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron regmap_bulk_read takes a void * for its val parameter. It certainly makes no sense to cast to a (u8 *) + no need to explicitly cast at all when converting another pointer type to void *. Signed-off-by: Jonathan Cameron Reviewed-by: Alexandru Ardelean --- drivers/iio/accel/mxc4005.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c index 3d5bea651923..9d07642c0de1 100644 --- a/drivers/iio/accel/mxc4005.c +++ b/drivers/iio/accel/mxc4005.c @@ -135,7 +135,7 @@ static int mxc4005_read_xyz(struct mxc4005_data *data) int ret; ret = regmap_bulk_read(data->regmap, MXC4005_REG_XOUT_UPPER, - (u8 *) data->buffer, sizeof(data->buffer)); + data->buffer, sizeof(data->buffer)); if (ret < 0) { dev_err(data->dev, "failed to read axes\n"); return ret; @@ -150,7 +150,7 @@ static int mxc4005_read_axis(struct mxc4005_data *data, __be16 reg; int ret; - ret = regmap_bulk_read(data->regmap, addr, (u8 *) ®, sizeof(reg)); + ret = regmap_bulk_read(data->regmap, addr, ®, sizeof(reg)); if (ret < 0) { dev_err(data->dev, "failed to read reg %02x\n", addr); return ret; From patchwork Sun Apr 5 18:03:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 11474801 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A3CF159A for ; Sun, 5 Apr 2020 18:05:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 202C5206F5 for ; Sun, 5 Apr 2020 18:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109951; bh=bjBl2F1hxOLL/0V57XCwPmUPsGgwjT98epXBwn0AS8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VHrex+8aOSGsDRPhuz46sFtKEvSrgo2ZJ9AbnC4tL6xypZW4YwOgqshWcErBbUAQs PZtPDEyz2Gzi6V+o9ToraK6IzxabzxJ11XexX6Ry/GYt6erN4OeVRCB/8Q2vBdkoo5 pNVPy54yvq/B/Zv9tJwOzi3zMfEOPPjwRLTNFyX0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727461AbgDESFu (ORCPT ); Sun, 5 Apr 2020 14:05:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:54234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726771AbgDESFu (ORCPT ); Sun, 5 Apr 2020 14:05:50 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E611720678; Sun, 5 Apr 2020 18:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109949; bh=bjBl2F1hxOLL/0V57XCwPmUPsGgwjT98epXBwn0AS8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0IasuG+4AVUobAPcxhcPVG8q4WAbHSgtMrePRs3jaWFCm/OzZhekAh746egVBGjhy 3oY+1Ef9GbON8aacb/nXszrl6CTbbP3qpJ7iy3mWYOnQxXMHQbrXCjcZVPnupKHnHf 326dvKznRfWJRGwizv83IYgY/VKZ3SxU6WM9kies= From: jic23@kernel.org To: linux-iio@vger.kernel.org Cc: Andy Shevchenko , Jonathan Cameron , Matt Ranostay Subject: [PATCH 2/6] iio:chemical:atlas-sensor: Drop unnecessary explicit casts in regmap_bulk_read calls Date: Sun, 5 Apr 2020 19:03:17 +0100 Message-Id: <20200405180321.1737310-3-jic23@kernel.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200405180321.1737310-1-jic23@kernel.org> References: <20200405180321.1737310-1-jic23@kernel.org> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron regmap_bulk_read takes a void * for its val parameter. It certainly makes no sense to cast to a (u8 *) + no need to explicitly cast at all when converting another pointer type to void *. Signed-off-by: Jonathan Cameron Cc: Matt Ranostay Acked-by: Matt Ranostay --- drivers/iio/chemical/atlas-sensor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c index 82d470561ad3..973cdb4f1e83 100644 --- a/drivers/iio/chemical/atlas-sensor.c +++ b/drivers/iio/chemical/atlas-sensor.c @@ -426,8 +426,7 @@ static irqreturn_t atlas_trigger_handler(int irq, void *private) int ret; ret = regmap_bulk_read(data->regmap, data->chip->data_reg, - (u8 *) &data->buffer, - sizeof(__be32) * channels); + &data->buffer, sizeof(__be32) * channels); if (!ret) iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, @@ -463,7 +462,7 @@ static int atlas_read_measurement(struct atlas_data *data, int reg, __be32 *val) if (suspended) msleep(data->chip->delay); - ret = regmap_bulk_read(data->regmap, reg, (u8 *) val, sizeof(*val)); + ret = regmap_bulk_read(data->regmap, reg, val, sizeof(*val)); pm_runtime_mark_last_busy(dev); pm_runtime_put_autosuspend(dev); @@ -485,7 +484,7 @@ static int atlas_read_raw(struct iio_dev *indio_dev, switch (chan->type) { case IIO_TEMP: ret = regmap_bulk_read(data->regmap, chan->address, - (u8 *) ®, sizeof(reg)); + ®, sizeof(reg)); break; case IIO_PH: case IIO_CONCENTRATION: From patchwork Sun Apr 5 18:03:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 11474803 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EAF63159A for ; Sun, 5 Apr 2020 18:05:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CAA10206F5 for ; Sun, 5 Apr 2020 18:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109955; bh=SwbF8pzGE0u/7ftL8nNFyTa7xLILgqw7rzr8Hslscog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=aQHdoZNf5i6144E+fXiOTKfkiv8KOFkesnRxHEA3YDGLVJxeZk362CCrViRpsrrX4 tH7Hcy3w7oyEccLRKtXqVFFerKTxKMNyaqnBODdGZb/WfOg6Cv5f/QeDmTCa4AToTB A8F2qLxsDwzNKUSc4A46M+qkAlEYxjM+i8azwlso= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727526AbgDESFz (ORCPT ); Sun, 5 Apr 2020 14:05:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:54246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727509AbgDESFz (ORCPT ); Sun, 5 Apr 2020 14:05:55 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0BC8720678; Sun, 5 Apr 2020 18:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109953; bh=SwbF8pzGE0u/7ftL8nNFyTa7xLILgqw7rzr8Hslscog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MZfGafHd7qgI3gQ2QlPEe/6aByNkoqu9/DqWHX2P2KMxYrDFTnivWpocP9zdhbcKx eoU/PfKXe65yuE0uYsTiTx5t6T3I477Vx4TGdjRo3SeCBLdwQGbabbXOqJdAPy25g5 UfkxWMwxIkye2y1DlBhtQuMhDOnAfchZ2xrqAKGs= From: jic23@kernel.org To: linux-iio@vger.kernel.org Cc: Andy Shevchenko , Jonathan Cameron , Himanshu Jha Subject: [PATCH 3/6] iio:chemical:bme680: Tidy up parameters to regmap_bulk_read Date: Sun, 5 Apr 2020 19:03:18 +0100 Message-Id: <20200405180321.1737310-4-jic23@kernel.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200405180321.1737310-1-jic23@kernel.org> References: <20200405180321.1737310-1-jic23@kernel.org> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron A mixture of: * Unnecessary casts of val parameter to u8 * which makes little sense as the function take a void *. * Explicit sizes where we can use the destination type to define that. Note that's not true in all cases as we do read 3 bytes into 4 byte destinations. Note that noting was broken here, I'm just trying to ensure this doesn't get cut and paste into more drivers so cleaning these out subsystem wide. Signed-off-by: Jonathan Cameron CC: Himanshu Jha Acked-by: Himanshu Jha --- drivers/iio/chemical/bme680_core.c | 36 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c index ccde4c65ff93..13773e01699b 100644 --- a/drivers/iio/chemical/bme680_core.c +++ b/drivers/iio/chemical/bme680_core.c @@ -114,14 +114,16 @@ static int bme680_read_calib(struct bme680_data *data, __le16 buf; /* Temperature related coefficients */ - ret = regmap_bulk_read(data->regmap, BME680_T1_LSB_REG, (u8 *) &buf, 2); + ret = regmap_bulk_read(data->regmap, BME680_T1_LSB_REG, + &buf, sizeof(buf)); if (ret < 0) { dev_err(dev, "failed to read BME680_T1_LSB_REG\n"); return ret; } calib->par_t1 = le16_to_cpu(buf); - ret = regmap_bulk_read(data->regmap, BME680_T2_LSB_REG, (u8 *) &buf, 2); + ret = regmap_bulk_read(data->regmap, BME680_T2_LSB_REG, + &buf, sizeof(buf)); if (ret < 0) { dev_err(dev, "failed to read BME680_T2_LSB_REG\n"); return ret; @@ -136,14 +138,16 @@ static int bme680_read_calib(struct bme680_data *data, calib->par_t3 = tmp; /* Pressure related coefficients */ - ret = regmap_bulk_read(data->regmap, BME680_P1_LSB_REG, (u8 *) &buf, 2); + ret = regmap_bulk_read(data->regmap, BME680_P1_LSB_REG, + &buf, sizeof(buf)); if (ret < 0) { dev_err(dev, "failed to read BME680_P1_LSB_REG\n"); return ret; } calib->par_p1 = le16_to_cpu(buf); - ret = regmap_bulk_read(data->regmap, BME680_P2_LSB_REG, (u8 *) &buf, 2); + ret = regmap_bulk_read(data->regmap, BME680_P2_LSB_REG, + &buf, sizeof(buf)); if (ret < 0) { dev_err(dev, "failed to read BME680_P2_LSB_REG\n"); return ret; @@ -157,14 +161,16 @@ static int bme680_read_calib(struct bme680_data *data, } calib->par_p3 = tmp; - ret = regmap_bulk_read(data->regmap, BME680_P4_LSB_REG, (u8 *) &buf, 2); + ret = regmap_bulk_read(data->regmap, BME680_P4_LSB_REG, + &buf, sizeof(buf)); if (ret < 0) { dev_err(dev, "failed to read BME680_P4_LSB_REG\n"); return ret; } calib->par_p4 = le16_to_cpu(buf); - ret = regmap_bulk_read(data->regmap, BME680_P5_LSB_REG, (u8 *) &buf, 2); + ret = regmap_bulk_read(data->regmap, BME680_P5_LSB_REG, + &buf, sizeof(buf)); if (ret < 0) { dev_err(dev, "failed to read BME680_P5_LSB_REG\n"); return ret; @@ -185,14 +191,16 @@ static int bme680_read_calib(struct bme680_data *data, } calib->par_p7 = tmp; - ret = regmap_bulk_read(data->regmap, BME680_P8_LSB_REG, (u8 *) &buf, 2); + ret = regmap_bulk_read(data->regmap, BME680_P8_LSB_REG, + &buf, sizeof(buf)); if (ret < 0) { dev_err(dev, "failed to read BME680_P8_LSB_REG\n"); return ret; } calib->par_p8 = le16_to_cpu(buf); - ret = regmap_bulk_read(data->regmap, BME680_P9_LSB_REG, (u8 *) &buf, 2); + ret = regmap_bulk_read(data->regmap, BME680_P9_LSB_REG, + &buf, sizeof(buf)); if (ret < 0) { dev_err(dev, "failed to read BME680_P9_LSB_REG\n"); return ret; @@ -276,8 +284,8 @@ static int bme680_read_calib(struct bme680_data *data, } calib->par_gh1 = tmp; - ret = regmap_bulk_read(data->regmap, BME680_GH2_LSB_REG, (u8 *) &buf, - 2); + ret = regmap_bulk_read(data->regmap, BME680_GH2_LSB_REG, + &buf, sizeof(buf)); if (ret < 0) { dev_err(dev, "failed to read BME680_GH2_LSB_REG\n"); return ret; @@ -615,7 +623,7 @@ static int bme680_read_temp(struct bme680_data *data, int *val) return ret; ret = regmap_bulk_read(data->regmap, BME680_REG_TEMP_MSB, - (u8 *) &tmp, 3); + &tmp, 3); if (ret < 0) { dev_err(dev, "failed to read temperature\n"); return ret; @@ -656,7 +664,7 @@ static int bme680_read_press(struct bme680_data *data, return ret; ret = regmap_bulk_read(data->regmap, BME680_REG_PRESS_MSB, - (u8 *) &tmp, 3); + &tmp, 3); if (ret < 0) { dev_err(dev, "failed to read pressure\n"); return ret; @@ -689,7 +697,7 @@ static int bme680_read_humid(struct bme680_data *data, return ret; ret = regmap_bulk_read(data->regmap, BM6880_REG_HUMIDITY_MSB, - (u8 *) &tmp, 2); + &tmp, sizeof(tmp)); if (ret < 0) { dev_err(dev, "failed to read humidity\n"); return ret; @@ -754,7 +762,7 @@ static int bme680_read_gas(struct bme680_data *data, } ret = regmap_bulk_read(data->regmap, BME680_REG_GAS_MSB, - (u8 *) &tmp, 2); + &tmp, sizeof(tmp)); if (ret < 0) { dev_err(dev, "failed to read gas resistance\n"); return ret; From patchwork Sun Apr 5 18:03:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 11474805 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9578C14DD for ; Sun, 5 Apr 2020 18:06:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6B4F6206F5 for ; Sun, 5 Apr 2020 18:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109960; bh=d88SUaEzUyt7L1zsyfWDrWfWrZaeTiwYgxFv5uZDE28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ypjAvzf/qFLCQ1l1Pk7A948xHJuoURt46kWr8xqGCIAA5LFw0WojyH+hzFCvR7TWj SzTbH/83mYBFNrAoqraFr/ITXy4JxbLzsV+OVOeGL5J2Oz792LQemK+kOteIltZWrM mZYUjX0OXOCuH2bTDp+JT14PTkOaitWaH/LbrNtA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727548AbgDESGA (ORCPT ); Sun, 5 Apr 2020 14:06:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:54264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727522AbgDESF7 (ORCPT ); Sun, 5 Apr 2020 14:05:59 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 84C1C20678; Sun, 5 Apr 2020 18:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109959; bh=d88SUaEzUyt7L1zsyfWDrWfWrZaeTiwYgxFv5uZDE28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2pKAiENRiNy0PqJgtCyBzkDHkTO7kkRcONIb2G1Oe6xGd56sOtLmkbHb4F4H5/SFx KUEBlXo8ykcRxeKl/sUWhO7K71xx5qPVRJyP/pS366CZ+I5F5fZicS8sWNS8snMleO nkLTmuVfkIP6xelF4WJrBXI4zXhFO9Y0sf7EFUtE= From: jic23@kernel.org To: linux-iio@vger.kernel.org Cc: Andy Shevchenko , Jonathan Cameron , Jean-Baptiste Maneyrol Subject: [PATCH 4/6] iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions. Date: Sun, 5 Apr 2020 19:03:19 +0100 Message-Id: <20200405180321.1737310-5-jic23@kernel.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200405180321.1737310-1-jic23@kernel.org> References: <20200405180321.1737310-1-jic23@kernel.org> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron A mixture of: * Casts to u8 * for the val parameter which is void * and so needs no cast. * Explicit sizes when we can use sizeof on the destination / source variable. Not broken in anyway, I'm just trying to tidy up the is in the subsystem to avoid it getting cut and paste into new drivers. Signed-off-by: Jonathan Cameron Cc: Jean-Baptiste Maneyrol Reviewed-by: Alexandru Ardelean --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index e4b0d368c2f9..d3819b516ec6 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -526,7 +526,7 @@ static int inv_mpu6050_sensor_set(struct inv_mpu6050_state *st, int reg, __be16 d = cpu_to_be16(val); ind = (axis - IIO_MOD_X) * 2; - result = regmap_bulk_write(st->map, reg + ind, (u8 *)&d, 2); + result = regmap_bulk_write(st->map, reg + ind, &d, sizeof(d)); if (result) return -EINVAL; @@ -540,7 +540,7 @@ static int inv_mpu6050_sensor_show(struct inv_mpu6050_state *st, int reg, __be16 d; ind = (axis - IIO_MOD_X) * 2; - result = regmap_bulk_read(st->map, reg + ind, (u8 *)&d, 2); + result = regmap_bulk_read(st->map, reg + ind, &d, sizeof(d)); if (result) return -EINVAL; *val = (short)be16_to_cpup(&d); From patchwork Sun Apr 5 18:03:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 11474807 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 001AB159A for ; Sun, 5 Apr 2020 18:06:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA976206F7 for ; Sun, 5 Apr 2020 18:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109962; bh=9LIqdiBRumUXzybZ2GzIKED8/221i+8kZcN8AGEN5EM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QWBNYZLUuMVut/Rb6p3ghJZzhYl8lb+IlR9iEa3lxFfq68oYaAOEhpyO8//QVN+9N 5vIdti9VytxB0N4x5SQH+9tbiCM1ZKNvGXF0s7x045qQ4t6sMfiOG2NuFsnlkD+H1T wwbPGoT2gj6tYNPF3VRyqRZJ+6ssYnlrYeocLY9Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727593AbgDESGC (ORCPT ); Sun, 5 Apr 2020 14:06:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:54292 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727522AbgDESGC (ORCPT ); Sun, 5 Apr 2020 14:06:02 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 24236206C3; Sun, 5 Apr 2020 18:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109962; bh=9LIqdiBRumUXzybZ2GzIKED8/221i+8kZcN8AGEN5EM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l3YvZqDb582OFS6CHOxgXffrAyZZO4djeM+dY9IxHN/3IMLMHVGahiSANDTko7/3c hB7wNbq7BcqiNh+2E/TssJqUxH+uyRe7OFnXNcDCpDjGVACypqkib7o+SBMWQcRqCg ULo+6EINx6odTb487dbtExq7MfdOMGEY8DU7aJT4= From: jic23@kernel.org To: linux-iio@vger.kernel.org Cc: Andy Shevchenko , Jonathan Cameron , Daniel Baluta Subject: [PATCH 5/6] iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk* Date: Sun, 5 Apr 2020 19:03:20 +0100 Message-Id: <20200405180321.1737310-6-jic23@kernel.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200405180321.1737310-1-jic23@kernel.org> References: <20200405180321.1737310-1-jic23@kernel.org> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Given the parameter is void *, casting to u8 * is unnecessary. Signed-off-by: Jonathan Cameron Cc: Daniel Baluta Reviewed-by: Alexandru Ardelean --- drivers/iio/magnetometer/mmc35240.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c index 425cdd07b4e5..1787d656d009 100644 --- a/drivers/iio/magnetometer/mmc35240.c +++ b/drivers/iio/magnetometer/mmc35240.c @@ -239,7 +239,7 @@ static int mmc35240_init(struct mmc35240_data *data) return ret; ret = regmap_bulk_read(data->regmap, MMC35240_OTP_START_ADDR, - (u8 *)otp_data, sizeof(otp_data)); + otp_data, sizeof(otp_data)); if (ret < 0) return ret; @@ -295,7 +295,7 @@ static int mmc35240_read_measurement(struct mmc35240_data *data, __le16 buf[3]) if (ret < 0) return ret; - return regmap_bulk_read(data->regmap, MMC35240_REG_XOUT_L, (u8 *)buf, + return regmap_bulk_read(data->regmap, MMC35240_REG_XOUT_L, buf, 3 * sizeof(__le16)); } From patchwork Sun Apr 5 18:03:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 11474809 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 95BD214DD for ; Sun, 5 Apr 2020 18:06:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BDA2206C3 for ; Sun, 5 Apr 2020 18:06:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109965; bh=ID/jqjHYdnnsesPLM7ENzlshpNNWM4Io+glhCXAM+pg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=y5Lm3Gz1pDAdh0LhJpDRLNcLFFzYP1uMSJg0ZqQAiu7kBrhsw00mQXUIIonwBH5iM lURPuZPsZnLALXjF6x6azg33t9EJWAn5WvIl963EWxLl4/OBl9DstdqmwVp1Pt+6A2 37KoC21SlL1Xv5etc2jm8cWa/Wel0FUbHSOTwWjI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726776AbgDESGF (ORCPT ); Sun, 5 Apr 2020 14:06:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:54314 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727522AbgDESGE (ORCPT ); Sun, 5 Apr 2020 14:06:04 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A3D4620678; Sun, 5 Apr 2020 18:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586109964; bh=ID/jqjHYdnnsesPLM7ENzlshpNNWM4Io+glhCXAM+pg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DKXifLsnV1Xprj11ODEeEEdTHgWzT2QgHaWGmmesZgVjdw7ZzAbDy6nmK3dkOWX8d HvpOyYr+VL7tz1K29VaUhUDdSDGYkWThynJAMyGa+5X/8jDv7Z+VDzxI/huPoKgPKp QGd7Zk2TFAxhhei86ezw6g5BlPw9w8BXlHsvphL4= From: jic23@kernel.org To: linux-iio@vger.kernel.org Cc: Andy Shevchenko , Jonathan Cameron Subject: [PATCH 6/6] iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read Date: Sun, 5 Apr 2020 19:03:21 +0100 Message-Id: <20200405180321.1737310-7-jic23@kernel.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200405180321.1737310-1-jic23@kernel.org> References: <20200405180321.1737310-1-jic23@kernel.org> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron This only occurs once in the driver and isn't needed in this case either, so drop it. Signed-off-by: Jonathan Cameron Reviewed-by: Alexandru Ardelean --- drivers/iio/light/ltr501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index 71f99d2a22c1..0626927251bb 100644 --- a/drivers/iio/light/ltr501.c +++ b/drivers/iio/light/ltr501.c @@ -1263,7 +1263,7 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) if (mask & LTR501_STATUS_ALS_RDY) { ret = regmap_bulk_read(data->regmap, LTR501_ALS_DATA1, - (u8 *)als_buf, sizeof(als_buf)); + als_buf, sizeof(als_buf)); if (ret < 0) return ret; if (test_bit(0, indio_dev->active_scan_mask))