Backport 2 patches from [1] that cleanup the i2c-rtl9300 upstream driver. They have been long accepted and are already in mainline kernel as of 7.0-rc1. The "100-rtl9300-i2c-add-more-speeds.patch" required refreshing after adding these backport patches. [1] - https://lore.kernel.org/linux-i2c/20251217063027.37987-1-rosenp@gmail.com/ Signed-off-by: Rustam Adilov <adilov@tutamail.com> Link: https://github.com/openwrt/openwrt/pull/22662 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
55 lines
1.9 KiB
Diff
55 lines
1.9 KiB
Diff
From fc31008d5f57e71afa124550ca01b4399434435e Mon Sep 17 00:00:00 2001
|
|
From: Rosen Penev <rosenp@gmail.com>
|
|
Date: Tue, 16 Dec 2025 22:30:26 -0800
|
|
Subject: i2c: rtl9300: remove const cast
|
|
|
|
These casts are used to remove const for no good reason. Fix the types
|
|
instead.
|
|
|
|
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
|
|
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
|
|
Link: https://lore.kernel.org/r/20251217063027.37987-2-rosenp@gmail.com
|
|
---
|
|
drivers/i2c/busses/i2c-rtl9300.c | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
--- a/drivers/i2c/busses/i2c-rtl9300.c
|
|
+++ b/drivers/i2c/busses/i2c-rtl9300.c
|
|
@@ -129,7 +129,7 @@ static int rtl9310_i2c_select_scl(struct
|
|
|
|
static int rtl9300_i2c_config_chan(struct rtl9300_i2c *i2c, struct rtl9300_i2c_chan *chan)
|
|
{
|
|
- struct rtl9300_i2c_drv_data *drv_data;
|
|
+ const struct rtl9300_i2c_drv_data *drv_data;
|
|
int ret;
|
|
|
|
if (i2c->sda_num == chan->sda_num)
|
|
@@ -139,7 +139,7 @@ static int rtl9300_i2c_config_chan(struc
|
|
if (ret)
|
|
return ret;
|
|
|
|
- drv_data = (struct rtl9300_i2c_drv_data *)device_get_match_data(i2c->dev);
|
|
+ drv_data = device_get_match_data(i2c->dev);
|
|
ret = drv_data->select_scl(i2c, i2c->scl_num);
|
|
if (ret)
|
|
return ret;
|
|
@@ -372,7 +372,7 @@ static int rtl9300_i2c_probe(struct plat
|
|
struct device *dev = &pdev->dev;
|
|
struct rtl9300_i2c *i2c;
|
|
struct fwnode_handle *child;
|
|
- struct rtl9300_i2c_drv_data *drv_data;
|
|
+ const struct rtl9300_i2c_drv_data *drv_data;
|
|
struct reg_field fields[F_NUM_FIELDS];
|
|
u32 clock_freq, scl_num, sda_num;
|
|
int ret, i = 0;
|
|
@@ -399,7 +399,7 @@ static int rtl9300_i2c_probe(struct plat
|
|
|
|
platform_set_drvdata(pdev, i2c);
|
|
|
|
- drv_data = (struct rtl9300_i2c_drv_data *)device_get_match_data(i2c->dev);
|
|
+ drv_data = device_get_match_data(i2c->dev);
|
|
if (device_get_child_node_count(dev) > drv_data->max_nchan)
|
|
return dev_err_probe(dev, -EINVAL, "Too many channels\n");
|
|
|