What is the difference between printk_debug("smbus: %s[%d]->", dev_path(dev->bus->dev), dev->bus->link ); printk_debug("%s", dev_path(dev));
and
printk_debug("smbus: %s[%d]->%s", dev_path(dev->bus->dev), dev->bus->link , dev_path(dev));
the first print smbus: PCI: 01:01.1[0]->I2C: 50
the second one print smbus: PCI: 01:01.1[0]-> PCI: 01:01.1
YH
YhLu YhLu@tyan.com writes:
What is the difference between printk_debug("smbus: %s[%d]->", dev_path(dev->bus->dev), dev->bus->link ); printk_debug("%s", dev_path(dev));
and
printk_debug("smbus: %s[%d]->%s", dev_path(dev->bus->dev),
dev->bus->link , dev_path(dev));
the first print smbus: PCI: 01:01.1[0]->I2C: 50
the second one print smbus: PCI: 01:01.1[0]-> PCI: 01:01.1
dev_path returns the address of a statically allocated buffer that it puts the path in. That address is always the same. So multiple calls to dev_path before printing the path are a problem.
I had a hard time balancing convenience and safety when implementing this.
If we need to fix this likely there are 2 possibilities. 1) Pass dev_path the address of a buffer, to write into. 2) Update printk to have a special format flag that performs the actions of dev_path.
Except for being a gotcha to watch out for I think we are ok.
Eric