+++ /dev/null
-From 87a19890a13e0e5f2c13b387973d7153bfc0681f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 5 Apr 2023 17:41:49 +0800
-Subject: i3c: Allow OF-alias-based persistent bus numbering
-
-From: Jeremy Kerr <jk@codeconstruct.com.au>
-
-[ Upstream commit 7dc2e0a875645a79f5c1c063019397e8e94008f5 ]
-
-Parse the /aliases node to assign any fixed bus numbers, as is done with
-the i2c subsystem. Numbering for non-aliased busses will start after the
-highest fixed bus number.
-
-This allows an alias node such as:
-
- aliases {
- i3c0 = &bus_a,
- i3c4 = &bus_b,
- };
-
-to set the numbering for a set of i3c controllers:
-
- /* fixed-numbered bus, assigned "i3c-0" */
- bus_a: i3c-master {
- };
-
- /* another fixed-numbered bus, assigned "i3c-4" */
- bus_b: i3c-master {
- };
-
- /* dynamic-numbered bus, likely assigned "i3c-5" */
- bus_c: i3c-master {
- };
-
-If no i3c device aliases are present, the numbering will stay as-is,
-starting from 0.
-
-Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
-Link: https://lore.kernel.org/r/20230405094149.1513209-1-jk@codeconstruct.com.au
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i3c/master.c | 30 +++++++++++++++++++++++++-----
- 1 file changed, 25 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
-index f9f96c4bb9002..332b1f02e6ea5 100644
---- a/drivers/i3c/master.c
-+++ b/drivers/i3c/master.c
-@@ -21,6 +21,7 @@
-
- static DEFINE_IDR(i3c_bus_idr);
- static DEFINE_MUTEX(i3c_core_lock);
-+static int __i3c_first_dynamic_bus_num;
-
- /**
- * i3c_bus_maintenance_lock - Lock the bus for a maintenance operation
-@@ -466,9 +467,9 @@ static void i3c_bus_cleanup(struct i3c_bus *i3cbus)
- mutex_unlock(&i3c_core_lock);
- }
-
--static int i3c_bus_init(struct i3c_bus *i3cbus)
-+static int i3c_bus_init(struct i3c_bus *i3cbus, struct device_node *np)
- {
-- int ret;
-+ int ret, start, end, id = -1;
-
- init_rwsem(&i3cbus->lock);
- INIT_LIST_HEAD(&i3cbus->devs.i2c);
-@@ -476,8 +477,19 @@ static int i3c_bus_init(struct i3c_bus *i3cbus)
- i3c_bus_init_addrslots(i3cbus);
- i3cbus->mode = I3C_BUS_MODE_PURE;
-
-+ if (np)
-+ id = of_alias_get_id(np, "i3c");
-+
- mutex_lock(&i3c_core_lock);
-- ret = idr_alloc(&i3c_bus_idr, i3cbus, 0, 0, GFP_KERNEL);
-+ if (id >= 0) {
-+ start = id;
-+ end = start + 1;
-+ } else {
-+ start = __i3c_first_dynamic_bus_num;
-+ end = 0;
-+ }
-+
-+ ret = idr_alloc(&i3c_bus_idr, i3cbus, start, end, GFP_KERNEL);
- mutex_unlock(&i3c_core_lock);
-
- if (ret < 0)
-@@ -2649,7 +2661,7 @@ int i3c_master_register(struct i3c_master_controller *master,
- INIT_LIST_HEAD(&master->boardinfo.i2c);
- INIT_LIST_HEAD(&master->boardinfo.i3c);
-
-- ret = i3c_bus_init(i3cbus);
-+ ret = i3c_bus_init(i3cbus, master->dev.of_node);
- if (ret)
- return ret;
-
-@@ -2858,8 +2870,16 @@ void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev)
-
- static int __init i3c_init(void)
- {
-- int res = bus_register_notifier(&i2c_bus_type, &i2cdev_notifier);
-+ int res;
-+
-+ res = of_alias_get_highest_id("i3c");
-+ if (res >= 0) {
-+ mutex_lock(&i3c_core_lock);
-+ __i3c_first_dynamic_bus_num = res + 1;
-+ mutex_unlock(&i3c_core_lock);
-+ }
-
-+ res = bus_register_notifier(&i2c_bus_type, &i2cdev_notifier);
- if (res)
- return res;
-
---
-2.51.0
-
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- drivers/i3c/master.c | 8 ++++----
+ drivers/i3c/master.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
-diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
-index 507fb6d26d330..527bea0ffcd7f 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
-@@ -2661,10 +2661,6 @@ int i3c_master_register(struct i3c_master_controller *master,
+@@ -2536,13 +2536,13 @@ int i3c_master_register(struct i3c_maste
INIT_LIST_HEAD(&master->boardinfo.i2c);
INIT_LIST_HEAD(&master->boardinfo.i3c);
-- ret = i3c_bus_init(i3cbus, master->dev.of_node);
+- ret = i3c_bus_init(i3cbus);
- if (ret)
- return ret;
-
device_initialize(&master->dev);
dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
-@@ -2672,6 +2668,10 @@ int i3c_master_register(struct i3c_master_controller *master,
- master->dev.coherent_dma_mask = parent->coherent_dma_mask;
- master->dev.dma_parms = parent->dma_parms;
-
+ ret = i3c_bus_init(i3cbus, master->dev.of_node);
+ if (ret)
+ goto err_put_dev;
ret = of_populate_i3c_bus(master);
if (ret)
goto err_put_dev;
---
-2.51.0
-
+++ /dev/null
-From 6cbf8b38dfe3aabe330f2c356949bc4d6a1f034f Mon Sep 17 00:00:00 2001
-From: Jamie Iles <quic_jiles@quicinc.com>
-Date: Tue, 8 Mar 2022 13:42:26 +0000
-Subject: i3c: fix uninitialized variable use in i2c setup
-
-From: Jamie Iles <quic_jiles@quicinc.com>
-
-commit 6cbf8b38dfe3aabe330f2c356949bc4d6a1f034f upstream.
-
-Commit 31b9887c7258 ("i3c: remove i2c board info from i2c_dev_desc")
-removed the boardinfo from i2c_dev_desc to decouple device enumeration from
-setup but did not correctly lookup the i2c_dev_desc to store the new
-device, instead dereferencing an uninitialized variable.
-
-Lookup the device that has already been registered by address to store
-the i2c client device.
-
-Fixes: 31b9887c7258 ("i3c: remove i2c board info from i2c_dev_desc")
-Reported-by: kernel test robot <lkp@intel.com>
-Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Signed-off-by: Jamie Iles <quic_jiles@quicinc.com>
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Link: https://lore.kernel.org/r/20220308134226.1042367-1-quic_jiles@quicinc.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/i3c/master.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
---- a/drivers/i3c/master.c
-+++ b/drivers/i3c/master.c
-@@ -2364,8 +2364,13 @@ static int i3c_master_i2c_adapter_init(s
- * We silently ignore failures here. The bus should keep working
- * correctly even if one or more i2c devices are not registered.
- */
-- list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node)
-+ list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node) {
-+ i2cdev = i3c_master_find_i2c_dev_by_addr(master,
-+ i2cboardinfo->base.addr);
-+ if (WARN_ON(!i2cdev))
-+ continue;
- i2cdev->dev = i2c_new_client_device(adap, &i2cboardinfo->base);
-+ }
-
- return 0;
- }
+++ /dev/null
-From 999ababfb403459469f4ccb51f0d1ef4dd0c0bad Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 21 Sep 2023 08:56:53 +0300
-Subject: i3c: master: Inherit DMA masks and parameters from parent device
-
-From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-
-[ Upstream commit 0c35691551387e060e6ae7a6652b4101270c73cf ]
-
-Copy the DMA masks and parameters for an I3C master device from parent
-device so that the master device has them set for the DMA buffer and
-mapping API.
-
-Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Link: https://lore.kernel.org/r/20230921055704.1087277-2-jarkko.nikula@linux.intel.com
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i3c/master.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
-index 332b1f02e6ea5..507fb6d26d330 100644
---- a/drivers/i3c/master.c
-+++ b/drivers/i3c/master.c
-@@ -2668,6 +2668,10 @@ int i3c_master_register(struct i3c_master_controller *master,
- device_initialize(&master->dev);
- dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
-
-+ master->dev.dma_mask = parent->dma_mask;
-+ master->dev.coherent_dma_mask = parent->coherent_dma_mask;
-+ master->dev.dma_parms = parent->dma_parms;
-+
- ret = of_populate_i3c_bus(master);
- if (ret)
- goto err_put_dev;
---
-2.51.0
-
+++ /dev/null
-From 9b27a1f1f57eb94b0028bf15f09d3ba7f5031121 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 17 Jan 2022 17:48:15 +0000
-Subject: i3c: remove i2c board info from i2c_dev_desc
-
-From: Jamie Iles <quic_jiles@quicinc.com>
-
-[ Upstream commit 31b9887c7258ca47d9c665a80f19f006c86756b1 ]
-
-I2C board info is only required during adapter setup so there is no
-requirement to keeping a pointer to it once running. To support dynamic
-device addition we can't rely on board info - user-space creation
-through sysfs won't have a boardinfo.
-
-Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Signed-off-by: Jamie Iles <quic_jiles@quicinc.com>
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Link: https://lore.kernel.org/r/20220117174816.1963463-2-quic_jiles@quicinc.com
-Stable-dep-of: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i3c/master.c | 18 ++++++++++--------
- include/linux/i3c/master.h | 1 -
- 2 files changed, 10 insertions(+), 9 deletions(-)
-
-diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
-index 203b7497b52dc..e3fffc5015c10 100644
---- a/drivers/i3c/master.c
-+++ b/drivers/i3c/master.c
-@@ -656,7 +656,7 @@ static void i3c_master_free_i2c_dev(struct i2c_dev_desc *dev)
-
- static struct i2c_dev_desc *
- i3c_master_alloc_i2c_dev(struct i3c_master_controller *master,
-- const struct i2c_dev_boardinfo *boardinfo)
-+ u16 addr, u8 lvr)
- {
- struct i2c_dev_desc *dev;
-
-@@ -665,9 +665,8 @@ i3c_master_alloc_i2c_dev(struct i3c_master_controller *master,
- return ERR_PTR(-ENOMEM);
-
- dev->common.master = master;
-- dev->boardinfo = boardinfo;
-- dev->addr = boardinfo->base.addr;
-- dev->lvr = boardinfo->lvr;
-+ dev->addr = addr;
-+ dev->lvr = lvr;
-
- return dev;
- }
-@@ -741,7 +740,7 @@ i3c_master_find_i2c_dev_by_addr(const struct i3c_master_controller *master,
- struct i2c_dev_desc *dev;
-
- i3c_bus_for_each_i2cdev(&master->bus, dev) {
-- if (dev->boardinfo->base.addr == addr)
-+ if (dev->addr == addr)
- return dev;
- }
-
-@@ -1731,7 +1730,9 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
- i2cboardinfo->base.addr,
- I3C_ADDR_SLOT_I2C_DEV);
-
-- i2cdev = i3c_master_alloc_i2c_dev(master, i2cboardinfo);
-+ i2cdev = i3c_master_alloc_i2c_dev(master,
-+ i2cboardinfo->base.addr,
-+ i2cboardinfo->lvr);
- if (IS_ERR(i2cdev)) {
- ret = PTR_ERR(i2cdev);
- goto err_detach_devs;
-@@ -2220,6 +2221,7 @@ static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
- {
- struct i2c_adapter *adap = i3c_master_to_i2c_adapter(master);
- struct i2c_dev_desc *i2cdev;
-+ struct i2c_dev_boardinfo *i2cboardinfo;
- int ret;
-
- adap->dev.parent = master->dev.parent;
-@@ -2239,8 +2241,8 @@ static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
- * We silently ignore failures here. The bus should keep working
- * correctly even if one or more i2c devices are not registered.
- */
-- i3c_bus_for_each_i2cdev(&master->bus, i2cdev)
-- i2cdev->dev = i2c_new_client_device(adap, &i2cdev->boardinfo->base);
-+ list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node)
-+ i2cdev->dev = i2c_new_client_device(adap, &i2cboardinfo->base);
-
- return 0;
- }
-diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
-index ea3781d730064..b31170e37655f 100644
---- a/include/linux/i3c/master.h
-+++ b/include/linux/i3c/master.h
-@@ -85,7 +85,6 @@ struct i2c_dev_boardinfo {
- */
- struct i2c_dev_desc {
- struct i3c_i2c_dev_desc common;
-- const struct i2c_dev_boardinfo *boardinfo;
- struct i2c_client *dev;
- u16 addr;
- u8 lvr;
---
-2.51.0
-
+++ /dev/null
-From 9f9c16a0e828c44e3b18f4f0778cbb171d16ac16 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 17 Jan 2022 17:48:16 +0000
-Subject: i3c: support dynamically added i2c devices
-
-From: Jamie Iles <quic_jiles@quicinc.com>
-
-[ Upstream commit 72a4501b5d089772671360a6ec74d5350acf8c2e ]
-
-I2C devices can be added to the system dynamically through several
-sources other than static board info including device tree overlays and
-sysfs i2c new_device.
-
-Add an I2C bus notifier to attach the clients at runtime if they were
-not defined in the board info. For DT devices find the LVR in the reg
-property, for user-space new_device additions we synthesize a
-conservative setting of no spike filters and fast mode only.
-
-Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Signed-off-by: Jamie Iles <quic_jiles@quicinc.com>
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Link: https://lore.kernel.org/r/20220117174816.1963463-3-quic_jiles@quicinc.com
-Stable-dep-of: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i3c/master.c | 128 ++++++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 127 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
-index e3fffc5015c10..f9f96c4bb9002 100644
---- a/drivers/i3c/master.c
-+++ b/drivers/i3c/master.c
-@@ -2212,11 +2212,122 @@ static u32 i3c_master_i2c_funcs(struct i2c_adapter *adapter)
- return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C;
- }
-
-+static u8 i3c_master_i2c_get_lvr(struct i2c_client *client)
-+{
-+ /* Fall back to no spike filters and FM bus mode. */
-+ u8 lvr = I3C_LVR_I2C_INDEX(2) | I3C_LVR_I2C_FM_MODE;
-+
-+ if (client->dev.of_node) {
-+ u32 reg[3];
-+
-+ if (!of_property_read_u32_array(client->dev.of_node, "reg",
-+ reg, ARRAY_SIZE(reg)))
-+ lvr = reg[2];
-+ }
-+
-+ return lvr;
-+}
-+
-+static int i3c_master_i2c_attach(struct i2c_adapter *adap, struct i2c_client *client)
-+{
-+ struct i3c_master_controller *master = i2c_adapter_to_i3c_master(adap);
-+ enum i3c_addr_slot_status status;
-+ struct i2c_dev_desc *i2cdev;
-+ int ret;
-+
-+ /* Already added by board info? */
-+ if (i3c_master_find_i2c_dev_by_addr(master, client->addr))
-+ return 0;
-+
-+ status = i3c_bus_get_addr_slot_status(&master->bus, client->addr);
-+ if (status != I3C_ADDR_SLOT_FREE)
-+ return -EBUSY;
-+
-+ i3c_bus_set_addr_slot_status(&master->bus, client->addr,
-+ I3C_ADDR_SLOT_I2C_DEV);
-+
-+ i2cdev = i3c_master_alloc_i2c_dev(master, client->addr,
-+ i3c_master_i2c_get_lvr(client));
-+ if (IS_ERR(i2cdev)) {
-+ ret = PTR_ERR(i2cdev);
-+ goto out_clear_status;
-+ }
-+
-+ ret = i3c_master_attach_i2c_dev(master, i2cdev);
-+ if (ret)
-+ goto out_free_dev;
-+
-+ return 0;
-+
-+out_free_dev:
-+ i3c_master_free_i2c_dev(i2cdev);
-+out_clear_status:
-+ i3c_bus_set_addr_slot_status(&master->bus, client->addr,
-+ I3C_ADDR_SLOT_FREE);
-+
-+ return ret;
-+}
-+
-+static int i3c_master_i2c_detach(struct i2c_adapter *adap, struct i2c_client *client)
-+{
-+ struct i3c_master_controller *master = i2c_adapter_to_i3c_master(adap);
-+ struct i2c_dev_desc *dev;
-+
-+ dev = i3c_master_find_i2c_dev_by_addr(master, client->addr);
-+ if (!dev)
-+ return -ENODEV;
-+
-+ i3c_master_detach_i2c_dev(dev);
-+ i3c_bus_set_addr_slot_status(&master->bus, dev->addr,
-+ I3C_ADDR_SLOT_FREE);
-+ i3c_master_free_i2c_dev(dev);
-+
-+ return 0;
-+}
-+
- static const struct i2c_algorithm i3c_master_i2c_algo = {
- .master_xfer = i3c_master_i2c_adapter_xfer,
- .functionality = i3c_master_i2c_funcs,
- };
-
-+static int i3c_i2c_notifier_call(struct notifier_block *nb, unsigned long action,
-+ void *data)
-+{
-+ struct i2c_adapter *adap;
-+ struct i2c_client *client;
-+ struct device *dev = data;
-+ struct i3c_master_controller *master;
-+ int ret;
-+
-+ if (dev->type != &i2c_client_type)
-+ return 0;
-+
-+ client = to_i2c_client(dev);
-+ adap = client->adapter;
-+
-+ if (adap->algo != &i3c_master_i2c_algo)
-+ return 0;
-+
-+ master = i2c_adapter_to_i3c_master(adap);
-+
-+ i3c_bus_maintenance_lock(&master->bus);
-+ switch (action) {
-+ case BUS_NOTIFY_ADD_DEVICE:
-+ ret = i3c_master_i2c_attach(adap, client);
-+ break;
-+ case BUS_NOTIFY_DEL_DEVICE:
-+ ret = i3c_master_i2c_detach(adap, client);
-+ break;
-+ }
-+ i3c_bus_maintenance_unlock(&master->bus);
-+
-+ return ret;
-+}
-+
-+static struct notifier_block i2cdev_notifier = {
-+ .notifier_call = i3c_i2c_notifier_call,
-+};
-+
- static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
- {
- struct i2c_adapter *adap = i3c_master_to_i2c_adapter(master);
-@@ -2747,12 +2858,27 @@ void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev)
-
- static int __init i3c_init(void)
- {
-- return bus_register(&i3c_bus_type);
-+ int res = bus_register_notifier(&i2c_bus_type, &i2cdev_notifier);
-+
-+ if (res)
-+ return res;
-+
-+ res = bus_register(&i3c_bus_type);
-+ if (res)
-+ goto out_unreg_notifier;
-+
-+ return 0;
-+
-+out_unreg_notifier:
-+ bus_unregister_notifier(&i2c_bus_type, &i2cdev_notifier);
-+
-+ return res;
- }
- subsys_initcall(i3c_init);
-
- static void __exit i3c_exit(void)
- {
-+ bus_unregister_notifier(&i2c_bus_type, &i2cdev_notifier);
- idr_destroy(&i3c_bus_idr);
- bus_unregister(&i3c_bus_type);
- }
---
-2.51.0
-
x86-kmsan-don-t-instrument-stack-walking-functions.patch
x86-dumpstack-prevent-kasan-false-positive-warnings-.patch
pinctrl-stm32-fix-hwspinlock-resource-leak-in-probe-.patch
-i3c-remove-i2c-board-info-from-i2c_dev_desc.patch
-i3c-support-dynamically-added-i2c-devices.patch
-i3c-allow-of-alias-based-persistent-bus-numbering.patch
-i3c-master-inherit-dma-masks-and-parameters-from-par.patch
i3c-fix-refcount-inconsistency-in-i3c_master_registe.patch
power-supply-wm831x-check-wm831x_set_bits-return-val.patch
power-supply-apm_power-only-unset-own-apm_get_power_.patch
alsa-dice-fix-buffer-overflow-in-detect_stream_formats.patch
nfs-fix-missing-unlock-in-nfs_unlink.patch
netfilter-nf_conncount-garbage-collection-is-not-skipped-when-jiffies-wrap-around.patch
-i3c-fix-uninitialized-variable-use-in-i2c-setup.patch
netfilter-nft_connlimit-memleak-if-nf_ct_netns_get-fails.patch
bpf-arm64-do-not-audit-capability-check-in-do_jit.patch
btrfs-fix-memory-leak-of-fs_devices-in-degraded-seed.patch
+++ /dev/null
-From c021a3d48ea2b4c728c8c90773efd52a8b637dff Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 5 Apr 2023 17:41:49 +0800
-Subject: i3c: Allow OF-alias-based persistent bus numbering
-
-From: Jeremy Kerr <jk@codeconstruct.com.au>
-
-[ Upstream commit 7dc2e0a875645a79f5c1c063019397e8e94008f5 ]
-
-Parse the /aliases node to assign any fixed bus numbers, as is done with
-the i2c subsystem. Numbering for non-aliased busses will start after the
-highest fixed bus number.
-
-This allows an alias node such as:
-
- aliases {
- i3c0 = &bus_a,
- i3c4 = &bus_b,
- };
-
-to set the numbering for a set of i3c controllers:
-
- /* fixed-numbered bus, assigned "i3c-0" */
- bus_a: i3c-master {
- };
-
- /* another fixed-numbered bus, assigned "i3c-4" */
- bus_b: i3c-master {
- };
-
- /* dynamic-numbered bus, likely assigned "i3c-5" */
- bus_c: i3c-master {
- };
-
-If no i3c device aliases are present, the numbering will stay as-is,
-starting from 0.
-
-Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
-Link: https://lore.kernel.org/r/20230405094149.1513209-1-jk@codeconstruct.com.au
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i3c/master.c | 30 +++++++++++++++++++++++++-----
- 1 file changed, 25 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
-index ae60eb7b27601..209aa1e889044 100644
---- a/drivers/i3c/master.c
-+++ b/drivers/i3c/master.c
-@@ -21,6 +21,7 @@
-
- static DEFINE_IDR(i3c_bus_idr);
- static DEFINE_MUTEX(i3c_core_lock);
-+static int __i3c_first_dynamic_bus_num;
-
- /**
- * i3c_bus_maintenance_lock - Lock the bus for a maintenance operation
-@@ -420,9 +421,9 @@ static void i3c_bus_cleanup(struct i3c_bus *i3cbus)
- mutex_unlock(&i3c_core_lock);
- }
-
--static int i3c_bus_init(struct i3c_bus *i3cbus)
-+static int i3c_bus_init(struct i3c_bus *i3cbus, struct device_node *np)
- {
-- int ret;
-+ int ret, start, end, id = -1;
-
- init_rwsem(&i3cbus->lock);
- INIT_LIST_HEAD(&i3cbus->devs.i2c);
-@@ -430,8 +431,19 @@ static int i3c_bus_init(struct i3c_bus *i3cbus)
- i3c_bus_init_addrslots(i3cbus);
- i3cbus->mode = I3C_BUS_MODE_PURE;
-
-+ if (np)
-+ id = of_alias_get_id(np, "i3c");
-+
- mutex_lock(&i3c_core_lock);
-- ret = idr_alloc(&i3c_bus_idr, i3cbus, 0, 0, GFP_KERNEL);
-+ if (id >= 0) {
-+ start = id;
-+ end = start + 1;
-+ } else {
-+ start = __i3c_first_dynamic_bus_num;
-+ end = 0;
-+ }
-+
-+ ret = idr_alloc(&i3c_bus_idr, i3cbus, start, end, GFP_KERNEL);
- mutex_unlock(&i3c_core_lock);
-
- if (ret < 0)
-@@ -2607,7 +2619,7 @@ int i3c_master_register(struct i3c_master_controller *master,
- INIT_LIST_HEAD(&master->boardinfo.i2c);
- INIT_LIST_HEAD(&master->boardinfo.i3c);
-
-- ret = i3c_bus_init(i3cbus);
-+ ret = i3c_bus_init(i3cbus, master->dev.of_node);
- if (ret)
- return ret;
-
-@@ -2816,8 +2828,16 @@ void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev)
-
- static int __init i3c_init(void)
- {
-- int res = bus_register_notifier(&i2c_bus_type, &i2cdev_notifier);
-+ int res;
-+
-+ res = of_alias_get_highest_id("i3c");
-+ if (res >= 0) {
-+ mutex_lock(&i3c_core_lock);
-+ __i3c_first_dynamic_bus_num = res + 1;
-+ mutex_unlock(&i3c_core_lock);
-+ }
-
-+ res = bus_register_notifier(&i2c_bus_type, &i2cdev_notifier);
- if (res)
- return res;
-
---
-2.51.0
-
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- drivers/i3c/master.c | 8 ++++----
+ drivers/i3c/master.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
-diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
-index 459399cd70da7..e5a282053e2a9 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
-@@ -2619,10 +2619,6 @@ int i3c_master_register(struct i3c_master_controller *master,
+@@ -2494,13 +2494,13 @@ int i3c_master_register(struct i3c_maste
INIT_LIST_HEAD(&master->boardinfo.i2c);
INIT_LIST_HEAD(&master->boardinfo.i3c);
-- ret = i3c_bus_init(i3cbus, master->dev.of_node);
+- ret = i3c_bus_init(i3cbus);
- if (ret)
- return ret;
-
device_initialize(&master->dev);
dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
-@@ -2630,6 +2626,10 @@ int i3c_master_register(struct i3c_master_controller *master,
- master->dev.coherent_dma_mask = parent->coherent_dma_mask;
- master->dev.dma_parms = parent->dma_parms;
-
+ ret = i3c_bus_init(i3cbus, master->dev.of_node);
+ if (ret)
+ goto err_put_dev;
ret = of_populate_i3c_bus(master);
if (ret)
goto err_put_dev;
---
-2.51.0
-
+++ /dev/null
-From 6cbf8b38dfe3aabe330f2c356949bc4d6a1f034f Mon Sep 17 00:00:00 2001
-From: Jamie Iles <quic_jiles@quicinc.com>
-Date: Tue, 8 Mar 2022 13:42:26 +0000
-Subject: i3c: fix uninitialized variable use in i2c setup
-
-From: Jamie Iles <quic_jiles@quicinc.com>
-
-commit 6cbf8b38dfe3aabe330f2c356949bc4d6a1f034f upstream.
-
-Commit 31b9887c7258 ("i3c: remove i2c board info from i2c_dev_desc")
-removed the boardinfo from i2c_dev_desc to decouple device enumeration from
-setup but did not correctly lookup the i2c_dev_desc to store the new
-device, instead dereferencing an uninitialized variable.
-
-Lookup the device that has already been registered by address to store
-the i2c client device.
-
-Fixes: 31b9887c7258 ("i3c: remove i2c board info from i2c_dev_desc")
-Reported-by: kernel test robot <lkp@intel.com>
-Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Signed-off-by: Jamie Iles <quic_jiles@quicinc.com>
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Link: https://lore.kernel.org/r/20220308134226.1042367-1-quic_jiles@quicinc.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/i3c/master.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
---- a/drivers/i3c/master.c
-+++ b/drivers/i3c/master.c
-@@ -2322,8 +2322,13 @@ static int i3c_master_i2c_adapter_init(s
- * We silently ignore failures here. The bus should keep working
- * correctly even if one or more i2c devices are not registered.
- */
-- list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node)
-+ list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node) {
-+ i2cdev = i3c_master_find_i2c_dev_by_addr(master,
-+ i2cboardinfo->base.addr);
-+ if (WARN_ON(!i2cdev))
-+ continue;
- i2cdev->dev = i2c_new_client_device(adap, &i2cboardinfo->base);
-+ }
-
- return 0;
- }
+++ /dev/null
-From 06f0b8c88899401cb78d695eb74baf4deb552847 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 21 Sep 2023 08:56:53 +0300
-Subject: i3c: master: Inherit DMA masks and parameters from parent device
-
-From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-
-[ Upstream commit 0c35691551387e060e6ae7a6652b4101270c73cf ]
-
-Copy the DMA masks and parameters for an I3C master device from parent
-device so that the master device has them set for the DMA buffer and
-mapping API.
-
-Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Link: https://lore.kernel.org/r/20230921055704.1087277-2-jarkko.nikula@linux.intel.com
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Stable-dep-of: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i3c/master.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
-index 209aa1e889044..459399cd70da7 100644
---- a/drivers/i3c/master.c
-+++ b/drivers/i3c/master.c
-@@ -2626,6 +2626,10 @@ int i3c_master_register(struct i3c_master_controller *master,
- device_initialize(&master->dev);
- dev_set_name(&master->dev, "i3c-%d", i3cbus->id);
-
-+ master->dev.dma_mask = parent->dma_mask;
-+ master->dev.coherent_dma_mask = parent->coherent_dma_mask;
-+ master->dev.dma_parms = parent->dma_parms;
-+
- ret = of_populate_i3c_bus(master);
- if (ret)
- goto err_put_dev;
---
-2.51.0
-
+++ /dev/null
-From 85c791dc850da64b6c09c181c5564d358fbdaaec Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 17 Jan 2022 17:48:15 +0000
-Subject: i3c: remove i2c board info from i2c_dev_desc
-
-From: Jamie Iles <quic_jiles@quicinc.com>
-
-[ Upstream commit 31b9887c7258ca47d9c665a80f19f006c86756b1 ]
-
-I2C board info is only required during adapter setup so there is no
-requirement to keeping a pointer to it once running. To support dynamic
-device addition we can't rely on board info - user-space creation
-through sysfs won't have a boardinfo.
-
-Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Signed-off-by: Jamie Iles <quic_jiles@quicinc.com>
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Link: https://lore.kernel.org/r/20220117174816.1963463-2-quic_jiles@quicinc.com
-Stable-dep-of: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i3c/master.c | 18 ++++++++++--------
- include/linux/i3c/master.h | 1 -
- 2 files changed, 10 insertions(+), 9 deletions(-)
-
-diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
-index 717b337f9e22d..d4e9299472679 100644
---- a/drivers/i3c/master.c
-+++ b/drivers/i3c/master.c
-@@ -610,7 +610,7 @@ static void i3c_master_free_i2c_dev(struct i2c_dev_desc *dev)
-
- static struct i2c_dev_desc *
- i3c_master_alloc_i2c_dev(struct i3c_master_controller *master,
-- const struct i2c_dev_boardinfo *boardinfo)
-+ u16 addr, u8 lvr)
- {
- struct i2c_dev_desc *dev;
-
-@@ -619,9 +619,8 @@ i3c_master_alloc_i2c_dev(struct i3c_master_controller *master,
- return ERR_PTR(-ENOMEM);
-
- dev->common.master = master;
-- dev->boardinfo = boardinfo;
-- dev->addr = boardinfo->base.addr;
-- dev->lvr = boardinfo->lvr;
-+ dev->addr = addr;
-+ dev->lvr = lvr;
-
- return dev;
- }
-@@ -695,7 +694,7 @@ i3c_master_find_i2c_dev_by_addr(const struct i3c_master_controller *master,
- struct i2c_dev_desc *dev;
-
- i3c_bus_for_each_i2cdev(&master->bus, dev) {
-- if (dev->boardinfo->base.addr == addr)
-+ if (dev->addr == addr)
- return dev;
- }
-
-@@ -1692,7 +1691,9 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
- i2cboardinfo->base.addr,
- I3C_ADDR_SLOT_I2C_DEV);
-
-- i2cdev = i3c_master_alloc_i2c_dev(master, i2cboardinfo);
-+ i2cdev = i3c_master_alloc_i2c_dev(master,
-+ i2cboardinfo->base.addr,
-+ i2cboardinfo->lvr);
- if (IS_ERR(i2cdev)) {
- ret = PTR_ERR(i2cdev);
- goto err_detach_devs;
-@@ -2178,6 +2179,7 @@ static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
- {
- struct i2c_adapter *adap = i3c_master_to_i2c_adapter(master);
- struct i2c_dev_desc *i2cdev;
-+ struct i2c_dev_boardinfo *i2cboardinfo;
- int ret;
-
- adap->dev.parent = master->dev.parent;
-@@ -2197,8 +2199,8 @@ static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
- * We silently ignore failures here. The bus should keep working
- * correctly even if one or more i2c devices are not registered.
- */
-- i3c_bus_for_each_i2cdev(&master->bus, i2cdev)
-- i2cdev->dev = i2c_new_client_device(adap, &i2cdev->boardinfo->base);
-+ list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node)
-+ i2cdev->dev = i2c_new_client_device(adap, &i2cboardinfo->base);
-
- return 0;
- }
-diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
-index 9cb39d901cd5f..604a126b78c83 100644
---- a/include/linux/i3c/master.h
-+++ b/include/linux/i3c/master.h
-@@ -85,7 +85,6 @@ struct i2c_dev_boardinfo {
- */
- struct i2c_dev_desc {
- struct i3c_i2c_dev_desc common;
-- const struct i2c_dev_boardinfo *boardinfo;
- struct i2c_client *dev;
- u16 addr;
- u8 lvr;
---
-2.51.0
-
+++ /dev/null
-From ebd98f6d964e045e332a0380adf21fc121f2ea7a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 17 Jan 2022 17:48:16 +0000
-Subject: i3c: support dynamically added i2c devices
-
-From: Jamie Iles <quic_jiles@quicinc.com>
-
-[ Upstream commit 72a4501b5d089772671360a6ec74d5350acf8c2e ]
-
-I2C devices can be added to the system dynamically through several
-sources other than static board info including device tree overlays and
-sysfs i2c new_device.
-
-Add an I2C bus notifier to attach the clients at runtime if they were
-not defined in the board info. For DT devices find the LVR in the reg
-property, for user-space new_device additions we synthesize a
-conservative setting of no spike filters and fast mode only.
-
-Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Signed-off-by: Jamie Iles <quic_jiles@quicinc.com>
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Link: https://lore.kernel.org/r/20220117174816.1963463-3-quic_jiles@quicinc.com
-Stable-dep-of: 9d4f219807d5 ("i3c: fix refcount inconsistency in i3c_master_register")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i3c/master.c | 128 ++++++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 127 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
-index d4e9299472679..ae60eb7b27601 100644
---- a/drivers/i3c/master.c
-+++ b/drivers/i3c/master.c
-@@ -2170,11 +2170,122 @@ static u32 i3c_master_i2c_funcs(struct i2c_adapter *adapter)
- return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C;
- }
-
-+static u8 i3c_master_i2c_get_lvr(struct i2c_client *client)
-+{
-+ /* Fall back to no spike filters and FM bus mode. */
-+ u8 lvr = I3C_LVR_I2C_INDEX(2) | I3C_LVR_I2C_FM_MODE;
-+
-+ if (client->dev.of_node) {
-+ u32 reg[3];
-+
-+ if (!of_property_read_u32_array(client->dev.of_node, "reg",
-+ reg, ARRAY_SIZE(reg)))
-+ lvr = reg[2];
-+ }
-+
-+ return lvr;
-+}
-+
-+static int i3c_master_i2c_attach(struct i2c_adapter *adap, struct i2c_client *client)
-+{
-+ struct i3c_master_controller *master = i2c_adapter_to_i3c_master(adap);
-+ enum i3c_addr_slot_status status;
-+ struct i2c_dev_desc *i2cdev;
-+ int ret;
-+
-+ /* Already added by board info? */
-+ if (i3c_master_find_i2c_dev_by_addr(master, client->addr))
-+ return 0;
-+
-+ status = i3c_bus_get_addr_slot_status(&master->bus, client->addr);
-+ if (status != I3C_ADDR_SLOT_FREE)
-+ return -EBUSY;
-+
-+ i3c_bus_set_addr_slot_status(&master->bus, client->addr,
-+ I3C_ADDR_SLOT_I2C_DEV);
-+
-+ i2cdev = i3c_master_alloc_i2c_dev(master, client->addr,
-+ i3c_master_i2c_get_lvr(client));
-+ if (IS_ERR(i2cdev)) {
-+ ret = PTR_ERR(i2cdev);
-+ goto out_clear_status;
-+ }
-+
-+ ret = i3c_master_attach_i2c_dev(master, i2cdev);
-+ if (ret)
-+ goto out_free_dev;
-+
-+ return 0;
-+
-+out_free_dev:
-+ i3c_master_free_i2c_dev(i2cdev);
-+out_clear_status:
-+ i3c_bus_set_addr_slot_status(&master->bus, client->addr,
-+ I3C_ADDR_SLOT_FREE);
-+
-+ return ret;
-+}
-+
-+static int i3c_master_i2c_detach(struct i2c_adapter *adap, struct i2c_client *client)
-+{
-+ struct i3c_master_controller *master = i2c_adapter_to_i3c_master(adap);
-+ struct i2c_dev_desc *dev;
-+
-+ dev = i3c_master_find_i2c_dev_by_addr(master, client->addr);
-+ if (!dev)
-+ return -ENODEV;
-+
-+ i3c_master_detach_i2c_dev(dev);
-+ i3c_bus_set_addr_slot_status(&master->bus, dev->addr,
-+ I3C_ADDR_SLOT_FREE);
-+ i3c_master_free_i2c_dev(dev);
-+
-+ return 0;
-+}
-+
- static const struct i2c_algorithm i3c_master_i2c_algo = {
- .master_xfer = i3c_master_i2c_adapter_xfer,
- .functionality = i3c_master_i2c_funcs,
- };
-
-+static int i3c_i2c_notifier_call(struct notifier_block *nb, unsigned long action,
-+ void *data)
-+{
-+ struct i2c_adapter *adap;
-+ struct i2c_client *client;
-+ struct device *dev = data;
-+ struct i3c_master_controller *master;
-+ int ret;
-+
-+ if (dev->type != &i2c_client_type)
-+ return 0;
-+
-+ client = to_i2c_client(dev);
-+ adap = client->adapter;
-+
-+ if (adap->algo != &i3c_master_i2c_algo)
-+ return 0;
-+
-+ master = i2c_adapter_to_i3c_master(adap);
-+
-+ i3c_bus_maintenance_lock(&master->bus);
-+ switch (action) {
-+ case BUS_NOTIFY_ADD_DEVICE:
-+ ret = i3c_master_i2c_attach(adap, client);
-+ break;
-+ case BUS_NOTIFY_DEL_DEVICE:
-+ ret = i3c_master_i2c_detach(adap, client);
-+ break;
-+ }
-+ i3c_bus_maintenance_unlock(&master->bus);
-+
-+ return ret;
-+}
-+
-+static struct notifier_block i2cdev_notifier = {
-+ .notifier_call = i3c_i2c_notifier_call,
-+};
-+
- static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
- {
- struct i2c_adapter *adap = i3c_master_to_i2c_adapter(master);
-@@ -2705,12 +2816,27 @@ void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev)
-
- static int __init i3c_init(void)
- {
-- return bus_register(&i3c_bus_type);
-+ int res = bus_register_notifier(&i2c_bus_type, &i2cdev_notifier);
-+
-+ if (res)
-+ return res;
-+
-+ res = bus_register(&i3c_bus_type);
-+ if (res)
-+ goto out_unreg_notifier;
-+
-+ return 0;
-+
-+out_unreg_notifier:
-+ bus_unregister_notifier(&i2c_bus_type, &i2cdev_notifier);
-+
-+ return res;
- }
- subsys_initcall(i3c_init);
-
- static void __exit i3c_exit(void)
- {
-+ bus_unregister_notifier(&i2c_bus_type, &i2cdev_notifier);
- idr_destroy(&i3c_bus_idr);
- bus_unregister(&i3c_bus_type);
- }
---
-2.51.0
-
x86-kmsan-don-t-instrument-stack-walking-functions.patch
x86-dumpstack-prevent-kasan-false-positive-warnings-.patch
pinctrl-stm32-fix-hwspinlock-resource-leak-in-probe-.patch
-i3c-remove-i2c-board-info-from-i2c_dev_desc.patch
-i3c-support-dynamically-added-i2c-devices.patch
-i3c-allow-of-alias-based-persistent-bus-numbering.patch
-i3c-master-inherit-dma-masks-and-parameters-from-par.patch
i3c-fix-refcount-inconsistency-in-i3c_master_registe.patch
i3c-master-svc-prevent-incomplete-ibi-transaction.patch
power-supply-wm831x-check-wm831x_set_bits-return-val.patch
coresight-etm4x-correct-polling-idle-bit.patch
spi-tegra210-quad-fix-validate-combined-sequence.patch
spi-tegra210-quad-fix-x1_x2_x4-encoding-and-support-x4-transfers.patch
-i3c-fix-uninitialized-variable-use-in-i2c-setup.patch
bpf-arm64-do-not-audit-capability-check-in-do_jit.patch
btrfs-fix-memory-leak-of-fs_devices-in-degraded-seed.patch
sched-deadline-only-set-free_cpus-for-online-runqueu.patch