public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] i2c: xiic: Make bus names unique
@ 2022-01-27 17:50 Robert Hancock
  2022-03-01 21:43 ` Wolfram Sang
  2022-03-02 21:26 ` Wolfram Sang
  0 siblings, 2 replies; 4+ messages in thread
From: Robert Hancock @ 2022-01-27 17:50 UTC (permalink / raw)
  To: linux-i2c
  Cc: michal.simek, ben-linux, richard.rojfors, linux-arm-kernel,
	Robert Hancock

This driver is for an FPGA logic core, so there can be arbitrarily many
instances of the bus on a given system. Previously all of the I2C bus
names were "xiic-i2c" which caused issues with lm_sensors when trying to
map human-readable names to sensor inputs because it could not properly
distinguish the busses, for example. Append the platform device name to
the I2C bus name so it is unique between different instances.

Fixes: e1d5b6598cdc ("i2c: Add support for Xilinx XPS IIC Bus Interface")
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
---
 drivers/i2c/busses/i2c-xiic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index eb789cfb9973..ffefe3c482e9 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -734,7 +734,6 @@ static const struct i2c_adapter_quirks xiic_quirks = {
 
 static const struct i2c_adapter xiic_adapter = {
 	.owner = THIS_MODULE,
-	.name = DRIVER_NAME,
 	.class = I2C_CLASS_DEPRECATED,
 	.algo = &xiic_algorithm,
 	.quirks = &xiic_quirks,
@@ -771,6 +770,8 @@ static int xiic_i2c_probe(struct platform_device *pdev)
 	i2c_set_adapdata(&i2c->adap, i2c);
 	i2c->adap.dev.parent = &pdev->dev;
 	i2c->adap.dev.of_node = pdev->dev.of_node;
+	snprintf(i2c->adap.name, sizeof(i2c->adap.name),
+		 DRIVER_NAME " %s", pdev->name);
 
 	mutex_init(&i2c->lock);
 
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: xiic: Make bus names unique
  2022-01-27 17:50 [PATCH] i2c: xiic: Make bus names unique Robert Hancock
@ 2022-03-01 21:43 ` Wolfram Sang
  2022-03-02 15:29   ` Michal Simek
  2022-03-02 21:26 ` Wolfram Sang
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2022-03-01 21:43 UTC (permalink / raw)
  To: Robert Hancock
  Cc: linux-i2c, michal.simek, ben-linux, richard.rojfors,
	linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 682 bytes --]

On Thu, Jan 27, 2022 at 11:50:13AM -0600, Robert Hancock wrote:
> This driver is for an FPGA logic core, so there can be arbitrarily many
> instances of the bus on a given system. Previously all of the I2C bus
> names were "xiic-i2c" which caused issues with lm_sensors when trying to
> map human-readable names to sensor inputs because it could not properly
> distinguish the busses, for example. Append the platform device name to
> the I2C bus name so it is unique between different instances.
> 
> Fixes: e1d5b6598cdc ("i2c: Add support for Xilinx XPS IIC Bus Interface")
> Signed-off-by: Robert Hancock <robert.hancock@calian.com>

Michal, is this okay with you?


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: xiic: Make bus names unique
  2022-03-01 21:43 ` Wolfram Sang
@ 2022-03-02 15:29   ` Michal Simek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2022-03-02 15:29 UTC (permalink / raw)
  To: Wolfram Sang, Robert Hancock, linux-i2c, michal.simek, ben-linux,
	richard.rojfors, linux-arm-kernel



On 3/1/22 22:43, Wolfram Sang wrote:
> On Thu, Jan 27, 2022 at 11:50:13AM -0600, Robert Hancock wrote:
>> This driver is for an FPGA logic core, so there can be arbitrarily many
>> instances of the bus on a given system. Previously all of the I2C bus
>> names were "xiic-i2c" which caused issues with lm_sensors when trying to
>> map human-readable names to sensor inputs because it could not properly
>> distinguish the busses, for example. Append the platform device name to
>> the I2C bus name so it is unique between different instances.
>>
>> Fixes: e1d5b6598cdc ("i2c: Add support for Xilinx XPS IIC Bus Interface")
>> Signed-off-by: Robert Hancock <robert.hancock@calian.com>
> 
> Michal, is this okay with you?
> 

Origin state

~# cat /sys/class/i2c-adapter/i2c-0/name
xiic-i2c

new state.

~# cat /sys/class/i2c-adapter/i2c-0/name
xiic-i2c 40800000.i2c

I am fine with it.

Tested-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: xiic: Make bus names unique
  2022-01-27 17:50 [PATCH] i2c: xiic: Make bus names unique Robert Hancock
  2022-03-01 21:43 ` Wolfram Sang
@ 2022-03-02 21:26 ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2022-03-02 21:26 UTC (permalink / raw)
  To: Robert Hancock
  Cc: linux-i2c, michal.simek, ben-linux, richard.rojfors,
	linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 680 bytes --]

On Thu, Jan 27, 2022 at 11:50:13AM -0600, Robert Hancock wrote:
> This driver is for an FPGA logic core, so there can be arbitrarily many
> instances of the bus on a given system. Previously all of the I2C bus
> names were "xiic-i2c" which caused issues with lm_sensors when trying to
> map human-readable names to sensor inputs because it could not properly
> distinguish the busses, for example. Append the platform device name to
> the I2C bus name so it is unique between different instances.
> 
> Fixes: e1d5b6598cdc ("i2c: Add support for Xilinx XPS IIC Bus Interface")
> Signed-off-by: Robert Hancock <robert.hancock@calian.com>

Applied to for-next, thanks!


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-02 21:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-27 17:50 [PATCH] i2c: xiic: Make bus names unique Robert Hancock
2022-03-01 21:43 ` Wolfram Sang
2022-03-02 15:29   ` Michal Simek
2022-03-02 21:26 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox