From nobody Mon Nov 25 22:52:38 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56EF7219C8D; Thu, 24 Oct 2024 19:12:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797133; cv=none; b=NQM4miCPMAQrJKWv0wTt8zp3vhdlBKXiCqnhZEdQDWP73JC4/OyXW1ZjNrDTS23T7tnC9klXTchv6L2RkliC2HDiGH6CuXLFQhsJPtfw05vS1Len7NtM84kIZoHTsixee/NWI7EtftftdsYlRrC0mrjxPcWNNBEWrX8xrIo/SSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797133; c=relaxed/simple; bh=nnUYxTU6Qk+voFfM495gKZUOSvntg7CaVSFrf4/2QkM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L+DbWTswN+IdtaEvF/+HbDH14k8UMbVdBvQShOgKEqJH7IpIsCaOy0pyWTtpQPFlvibBC6IwuUF6KoP6VC0Y0l3H0n8RyrzwfsmGbYL88i3WU48d0nwVyEOUjmaPbb0ZYEi/1FAbRBlHa4IW3ZYDFRw9ZK/5kFmT76u/sy7RdIg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=K3w4qmfP; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="K3w4qmfP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797131; x=1761333131; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nnUYxTU6Qk+voFfM495gKZUOSvntg7CaVSFrf4/2QkM=; b=K3w4qmfP1zfbFMm68o33Mf8H0ZT/Dq6g9TEg5FjSWPDT7xoBJ0vhQN3X kz4t2RVpsWoPxdosD5/Yo0Y6qd172kjZcVu3isCqFyTps+eT4wr4LcUiW a2rCTVNob7X4c/ZnjUHy6G7Yx8yRAPPtWTzo9RlKBTQ+97jFaGxfH54Ye 132y8C7B/q0nOi4HOMmm0MR/UE7WPSRzTP+b6HOJE5tE2gFLug3FSgxCG 2eKpx/2fkAO03HugRe+b/1UTh8VHou2Tak/NDxPopOtNarVidRQnzhN1u 8gc6Rx2/Ha0sL6/mkX/PzbiBdk9je9wCkVY+eTEFKiYBSgsEnyrFeX8Y6 g==; X-CSE-ConnectionGUID: yeVKRQOBSXS6b/BJvVc9OQ== X-CSE-MsgGUID: JeBr6j+zQjSmixOHYExayA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="29563185" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="29563185" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:08 -0700 X-CSE-ConnectionGUID: H++YmrIrRrGSaL1UxHbZsQ== X-CSE-MsgGUID: oYYXpd/RQuGMsOyWqcK6jg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="85791741" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 24 Oct 2024 12:12:06 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 860F25B8; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 09/24] iio: accel: kxcjk-1013: Use local variable for regs Date: Thu, 24 Oct 2024 22:04:58 +0300 Message-ID: <20241024191200.229894-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use local variable for regs in preparatory of further cleaning up changes. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 65 +++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 0cc34e17a23f..a5411d920025 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -445,9 +445,10 @@ MODULE_DEVICE_TABLE(acpi, kx_acpi_match); static int kxcjk1013_set_mode(struct kxcjk1013_data *data, enum kxcjk1013_mode mode) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -458,7 +459,7 @@ static int kxcjk1013_set_mode(struct kxcjk1013_data *da= ta, else ret |=3D KXCJK1013_REG_CTRL1_BIT_PC1; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->ctrl1, ret); + ret =3D i2c_smbus_write_byte_data(data->client, regs->ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_ctrl1\n"); return ret; @@ -470,9 +471,10 @@ static int kxcjk1013_set_mode(struct kxcjk1013_data *d= ata, static int kxcjk1013_get_mode(struct kxcjk1013_data *data, enum kxcjk1013_mode *mode) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -488,9 +490,10 @@ static int kxcjk1013_get_mode(struct kxcjk1013_data *d= ata, =20 static int kxcjk1013_set_range(struct kxcjk1013_data *data, int range_inde= x) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -501,7 +504,7 @@ static int kxcjk1013_set_range(struct kxcjk1013_data *d= ata, int range_index) ret |=3D (KXCJK1013_scale_table[range_index].gsel_0 << 3); ret |=3D (KXCJK1013_scale_table[range_index].gsel_1 << 4); =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->ctrl1, ret); + ret =3D i2c_smbus_write_byte_data(data->client, regs->ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_ctrl1\n"); return ret; @@ -514,6 +517,7 @@ static int kxcjk1013_set_range(struct kxcjk1013_data *d= ata, int range_index) =20 static int kxcjk1013_chip_init(struct kxcjk1013_data *data) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 #ifdef CONFIG_ACPI @@ -535,7 +539,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) if (ret < 0) return ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -544,7 +548,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) /* Set 12 bit mode */ ret |=3D KXCJK1013_REG_CTRL1_BIT_RES; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->ctrl1, ret); + ret =3D i2c_smbus_write_byte_data(data->client, regs->ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl\n"); return ret; @@ -555,7 +559,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) if (ret < 0) return ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->data_ctrl); + ret =3D i2c_smbus_read_byte_data(data->client, regs->data_ctrl); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_data_ctrl\n"); return ret; @@ -564,7 +568,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) data->odr_bits =3D ret; =20 /* Set up INT polarity */ - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_int_ctrl1\n"); return ret; @@ -575,7 +579,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) else ret &=3D ~KXCJK1013_REG_INT_CTRL1_BIT_IEA; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->int_ctrl1, re= t); + ret =3D i2c_smbus_write_byte_data(data->client, regs->int_ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_int_ctrl1\n"); return ret; @@ -637,18 +641,17 @@ static int kxcjk1013_set_power_state(struct kxcjk1013= _data *data, bool on) =20 static int kxcjk1013_chip_update_thresholds(struct kxcjk1013_data *data) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->wake_timer, - data->wake_dur); + ret =3D i2c_smbus_write_byte_data(data->client, regs->wake_timer, data->w= ake_dur); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_wake_timer\n"); return ret; } =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->wake_thres, - data->wake_thres); + ret =3D i2c_smbus_write_byte_data(data->client, regs->wake_thres, data->w= ake_thres); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_wake_thres\n"); return ret; @@ -660,6 +663,7 @@ static int kxcjk1013_chip_update_thresholds(struct kxcj= k1013_data *data) static int kxcjk1013_setup_any_motion_interrupt(struct kxcjk1013_data *dat= a, bool status) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; enum kxcjk1013_mode store_mode; =20 @@ -676,7 +680,7 @@ static int kxcjk1013_setup_any_motion_interrupt(struct = kxcjk1013_data *data, if (ret < 0) return ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_int_ctrl1\n"); return ret; @@ -687,13 +691,13 @@ static int kxcjk1013_setup_any_motion_interrupt(struc= t kxcjk1013_data *data, else ret &=3D ~KXCJK1013_REG_INT_CTRL1_BIT_IEN; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->int_ctrl1, re= t); + ret =3D i2c_smbus_write_byte_data(data->client, regs->int_ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_int_ctrl1\n"); return ret; } =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -704,7 +708,7 @@ static int kxcjk1013_setup_any_motion_interrupt(struct = kxcjk1013_data *data, else ret &=3D ~KXCJK1013_REG_CTRL1_BIT_WUFE; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->ctrl1, ret); + ret =3D i2c_smbus_write_byte_data(data->client, regs->ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_ctrl1\n"); return ret; @@ -722,6 +726,7 @@ static int kxcjk1013_setup_any_motion_interrupt(struct = kxcjk1013_data *data, static int kxcjk1013_setup_new_data_interrupt(struct kxcjk1013_data *data, bool status) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; enum kxcjk1013_mode store_mode; =20 @@ -734,7 +739,7 @@ static int kxcjk1013_setup_new_data_interrupt(struct kx= cjk1013_data *data, if (ret < 0) return ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_int_ctrl1\n"); return ret; @@ -745,13 +750,13 @@ static int kxcjk1013_setup_new_data_interrupt(struct = kxcjk1013_data *data, else ret &=3D ~KXCJK1013_REG_INT_CTRL1_BIT_IEN; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->int_ctrl1, re= t); + ret =3D i2c_smbus_write_byte_data(data->client, regs->int_ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_int_ctrl1\n"); return ret; } =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -762,7 +767,7 @@ static int kxcjk1013_setup_new_data_interrupt(struct kx= cjk1013_data *data, else ret &=3D ~KXCJK1013_REG_CTRL1_BIT_DRDY; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->ctrl1, ret); + ret =3D i2c_smbus_write_byte_data(data->client, regs->ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_ctrl1\n"); return ret; @@ -809,6 +814,7 @@ static int kxcjk1013_convert_odr_value(const struct kx_= odr_map *map, =20 static int kxcjk1013_set_odr(struct kxcjk1013_data *data, int val, int val= 2) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; enum kxcjk1013_mode store_mode; const struct kx_odr_map *odr_setting; @@ -834,7 +840,7 @@ static int kxcjk1013_set_odr(struct kxcjk1013_data *dat= a, int val, int val2) if (ret < 0) return ret; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->data_ctrl, + ret =3D i2c_smbus_write_byte_data(data->client, regs->data_ctrl, odr_setting->odr_bits); if (ret < 0) { dev_err(&data->client->dev, "Error writing data_ctrl\n"); @@ -843,7 +849,7 @@ static int kxcjk1013_set_odr(struct kxcjk1013_data *dat= a, int val, int val2) =20 data->odr_bits =3D odr_setting->odr_bits; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->wuf_ctrl, + ret =3D i2c_smbus_write_byte_data(data->client, regs->wuf_ctrl, odr_setting->wuf_bits); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_ctrl2\n"); @@ -1245,9 +1251,10 @@ static void kxcjk1013_trig_reen(struct iio_trigger *= trig) { struct iio_dev *indio_dev =3D iio_trigger_get_drvdata(trig); struct kxcjk1013_data *data =3D iio_priv(indio_dev); + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_rel); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_rel); if (ret < 0) dev_err(&data->client->dev, "Error reading reg_int_rel\n"); } @@ -1299,8 +1306,9 @@ static const struct iio_trigger_ops kxcjk1013_trigger= _ops =3D { static void kxcjk1013_report_motion_event(struct iio_dev *indio_dev) { struct kxcjk1013_data *data =3D iio_priv(indio_dev); + const struct kx_chipset_regs *regs =3D data->regs; =20 - int ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_src2); + int ret =3D i2c_smbus_read_byte_data(data->client, regs->int_src2); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_int_src2\n"); return; @@ -1365,9 +1373,10 @@ static irqreturn_t kxcjk1013_event_handler(int irq, = void *private) { struct iio_dev *indio_dev =3D private; struct kxcjk1013_data *data =3D iio_priv(indio_dev); + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_src1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_src1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_int_src1\n"); goto ack_intr; @@ -1390,7 +1399,7 @@ static irqreturn_t kxcjk1013_event_handler(int irq, v= oid *private) if (data->dready_trigger_on) return IRQ_HANDLED; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_rel); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_rel); if (ret < 0) dev_err(&data->client->dev, "Error reading reg_int_rel\n"); =20 --=20 2.43.0.rc1.1336.g36b5255a03ac