i2c: brcmstb: Fixed adapter named with optional interrupts
Subsystems (3)
PATCH 1/1 i2c: brcmstb: Fixed adapter named with optional interrupts
When the adapter is registered without interrupts, we would be showing the following:
# i2cdetect -l i2c-3 i2c Broadcom STB : I2C adapter
which is visually disturbing, only add the separator if we do have an interrupt.
--- drivers/i2c/busses/i2c-brcmstb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-brcmstb.c +4 -2
@@ -684,9 +684,11 @@ static int brcmstb_i2c_probe(struct platform_device *pdev) adap = &dev->adapter;i2c_set_adapdata (adap, dev); adap->owner =THIS_MODULE ; -strlcpy (adap->name,"Broadcom STB : " ,sizeof (adap->name)); -if (int_name) +strlcpy (adap->name,"Broadcom STB" ,sizeof (adap->name)); +if (int_name) { +strlcat (adap->name,": " ,sizeof (adap->name));strlcat (adap->name, int_name,sizeof (adap->name)); + } adap->algo = &brcmstb_i2c_algo; adap->dev.parent = &pdev->dev; adap->dev.of_node = pdev->dev.of_node;
Signature · 1 line
2.25.1
Quoted 5 lines · Florian Fainelli
When the adapter is registered without interrupts, we would be showing the following:
# i2cdetect -l i2c-3 i2c Broadcom STB : I2C adapter
What about switching to pdev->name here? That way you also get the base address for free to differentiate if there are multiple instances on the SoC?
Quoted 31 lines
which is visually disturbing, only add the separator if we do have an interrupt.
Fixes dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver")Signed-off-by Florian Fainelli <[email protected]>--- drivers/i2c/busses/i2c-brcmstb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/i2c/busses/i2c-brcmstb.c +4
-2@@ -684,9 +684,11 @@ static int brcmstb_i2c_probe(struct platform_device *pdev) adap = &dev->adapter;i2c_set_adapdata (adap, dev); adap->owner =THIS_MODULE ; -strlcpy (adap->name,"Broadcom STB : " ,sizeof (adap->name)); -if (int_name) +strlcpy (adap->name,"Broadcom STB" ,sizeof (adap->name)); +if (int_name) { +strlcat (adap->name,": " ,sizeof (adap->name));strlcat (adap->name, int_name,sizeof (adap->name)); + } adap->algo = &brcmstb_i2c_algo; adap->dev.parent = &pdev->dev; adap->dev.of_node = pdev->dev.of_node;Signature · 1 line
2.25.1
Quoted 10 lines · Wolfram Sang
Quoted 5 lines · Florian Fainelli
When the adapter is registered without interrupts, we would be showing the following:
# i2cdetect -l i2c-3 i2c Broadcom STB : I2C adapterWhat about switching to
pdev->namehere? That way you also get the base address for free to differentiate if there are multiple instances on the SoC?
I was not sure if we could change the adapter name reported as one could argue this is now ABI, but if we can, then using dev_name() is probably better. You are the maintainer you so know the rules on what is considered stable ABI and what is not :)
Signature · 1 line
Florian
Quoted 5 lines
I was not sure if we could change the adapter name reported as one could argue this is now ABI, but if we can, then using
dev_name()is probably better. You are the maintainer you so know the rules on what is considered stable ABI and what is not :)
Well, then even removing ":" would break the ABI :)
Please use dev_name. Other drivers changed that string, too. We never gave guarantees for that one.
Quoted 11 lines · Wolfram Sang
Quoted 5 lines
I was not sure if we could change the adapter name reported as one could argue this is now ABI, but if we can, then using
dev_name()is probably better. You are the maintainer you so know the rules on what is considered stable ABI and what is not :)Well, then even removing ":" would break the ABI :)
Please use
dev_name. Other drivers changed that string, too. We never gave guarantees for that one.
Fair enough, sent a v2 using dev_name(), thanks!
Signature · 1 line
Florian