Skip to content

Commit 52795f6

Browse files
jdelvareWolfram Sang
authored andcommitted
i2c: piix4: don't regress on bus names
The I2C bus names are supposed to be stable as they can be used by userspace to uniquely identify a specific I2C bus. So restore the original names for all legacy (pre-SB800) devices. For SB800 devices and later, improve the names. "SDA" refers to the serial data pin of each SMBus port, it's an implementation detail the user doesn't need to know. Use "port" instead, which is easier to understand. Signed-off-by: Jean Delvare <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Tested-by: Christian Fetzer <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 08c6e8c commit 52795f6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/i2c/busses/i2c-piix4.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ static const struct dmi_system_id piix4_dmi_ibm[] = {
139139
/* SB800 globals */
140140
static DEFINE_MUTEX(piix4_mutex_sb800);
141141
static const char *piix4_main_port_names_sb800[PIIX4_MAX_ADAPTERS] = {
142-
"SDA0", "SDA2", "SDA3", "SDA4"
142+
" port 0", " port 2", " port 3", " port 4"
143143
};
144-
static const char *piix4_aux_port_name_sb800 = "SDA1";
144+
static const char *piix4_aux_port_name_sb800 = " port 1";
145145

146146
struct i2c_piix4_adapdata {
147147
unsigned short smba;
@@ -660,7 +660,7 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba,
660660
adap->dev.parent = &dev->dev;
661661

662662
snprintf(adap->name, sizeof(adap->name),
663-
"SMBus PIIX4 adapter %s at %04x", name, smba);
663+
"SMBus PIIX4 adapter%s at %04x", name, smba);
664664

665665
i2c_set_adapdata(adap, adapdata);
666666

@@ -712,11 +712,14 @@ static int piix4_add_adapters_sb800(struct pci_dev *dev, unsigned short smba)
712712
static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
713713
{
714714
int retval;
715+
bool is_sb800 = false;
715716

716717
if ((dev->vendor == PCI_VENDOR_ID_ATI &&
717718
dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
718719
dev->revision >= 0x40) ||
719720
dev->vendor == PCI_VENDOR_ID_AMD) {
721+
is_sb800 = true;
722+
720723
if (!request_region(SB800_PIIX4_SMB_IDX, 2, "smba_idx")) {
721724
dev_err(&dev->dev,
722725
"SMBus base address index region 0x%x already in use!\n",
@@ -746,7 +749,7 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
746749
return retval;
747750

748751
/* Try to register main SMBus adapter, give up if we can't */
749-
retval = piix4_add_adapter(dev, retval, false, 0, "main",
752+
retval = piix4_add_adapter(dev, retval, false, 0, "",
750753
&piix4_main_adapters[0]);
751754
if (retval < 0)
752755
return retval;
@@ -774,7 +777,7 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
774777
/* Try to add the aux adapter if it exists,
775778
* piix4_add_adapter will clean up if this fails */
776779
piix4_add_adapter(dev, retval, false, 0,
777-
piix4_aux_port_name_sb800,
780+
is_sb800 ? piix4_aux_port_name_sb800 : "",
778781
&piix4_aux_adapter);
779782
}
780783

0 commit comments

Comments
 (0)