forked from luck/tmp_suning_uos_patched
i2c: Let bus drivers add SPD to their class
Let general purpose I2C/SMBus bus drivers add SPD to their class. Once this is done, we will be able to tell the eeprom driver to only probe for SPD EEPROMs and similar on these buses. Note that I took a conservative approach here, adding I2C_CLASS_SPD to many drivers that have no idea whether they can host SPD EEPROMs or not. This is to make sure that the eeprom driver doesn't stop probing buses where SPD EEPROMs or equivalent live. So, bus driver maintainers and users should feel free to remove the SPD class from drivers those buses never have SPD EEPROMs or they don't want the eeprom driver to bind to them. Likewise, feel free to add the SPD class to any bus driver I might have missed. Signed-off-by: Jean Delvare <khali@linux-fr.org>
This commit is contained in:
parent
c1b6b4f234
commit
3401b2fff3
@ -473,7 +473,7 @@ static const struct i2c_algorithm smbus_algorithm = {
|
||||
static struct i2c_adapter ali1535_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SMBUS_ALI1535,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
@ -382,7 +382,7 @@ static const struct i2c_algorithm ali1563_algorithm = {
|
||||
static struct i2c_adapter ali1563_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SMBUS_ALI1563,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &ali1563_algorithm,
|
||||
};
|
||||
|
||||
|
@ -471,7 +471,7 @@ static const struct i2c_algorithm smbus_algorithm = {
|
||||
static struct i2c_adapter ali15x3_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SMBUS_ALI15X3,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
@ -301,7 +301,7 @@ static const struct i2c_algorithm smbus_algorithm = {
|
||||
struct i2c_adapter amd756_smbus = {
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SMBUS_AMD756,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
@ -383,7 +383,7 @@ static int __devinit amd8111_probe(struct pci_dev *dev,
|
||||
snprintf(smbus->adapter.name, sizeof(smbus->adapter.name),
|
||||
"SMBus2 AMD8111 adapter at %04x", smbus->base);
|
||||
smbus->adapter.id = I2C_HW_SMBUS_AMD8111;
|
||||
smbus->adapter.class = I2C_CLASS_HWMON;
|
||||
smbus->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
|
||||
smbus->adapter.algo = &smbus_algorithm;
|
||||
smbus->adapter.algo_data = smbus;
|
||||
|
||||
|
@ -423,7 +423,7 @@ static const struct i2c_adapter cpm_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "i2c-cpm",
|
||||
.algo = &cpm_i2c_algo,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
};
|
||||
|
||||
static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
|
||||
|
@ -202,7 +202,7 @@ static struct i2c_algo_pcf_data pcf_isa_data = {
|
||||
|
||||
static struct i2c_adapter pcf_isa_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.id = I2C_HW_P_ELEK,
|
||||
.algo_data = &pcf_isa_data,
|
||||
.name = "i2c-elektor",
|
||||
|
@ -140,7 +140,7 @@ static int __init i2c_gpio_probe(struct platform_device *pdev)
|
||||
adap->owner = THIS_MODULE;
|
||||
snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
|
||||
adap->algo_data = bit_data;
|
||||
adap->class = I2C_CLASS_HWMON;
|
||||
adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
|
||||
adap->dev.parent = &pdev->dev;
|
||||
|
||||
/*
|
||||
|
@ -573,7 +573,7 @@ static const struct i2c_algorithm smbus_algorithm = {
|
||||
static struct i2c_adapter i801_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SMBUS_I801,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
@ -740,7 +740,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
|
||||
strcpy(adap->name, "IBM IIC");
|
||||
i2c_set_adapdata(adap, dev);
|
||||
adap->id = I2C_HW_OCP;
|
||||
adap->class = I2C_CLASS_HWMON;
|
||||
adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
|
||||
adap->algo = &iic_algo;
|
||||
adap->client_register = NULL;
|
||||
adap->client_unregister = NULL;
|
||||
@ -934,7 +934,7 @@ static int __devinit iic_probe(struct of_device *ofdev,
|
||||
strlcpy(adap->name, "IBM IIC", sizeof(adap->name));
|
||||
i2c_set_adapdata(adap, dev);
|
||||
adap->id = I2C_HW_OCP;
|
||||
adap->class = I2C_CLASS_HWMON;
|
||||
adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
|
||||
adap->algo = &iic_algo;
|
||||
adap->timeout = 1;
|
||||
adap->nr = dev->idx;
|
||||
|
@ -482,7 +482,7 @@ iop3xx_i2c_probe(struct platform_device *pdev)
|
||||
memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
|
||||
new_adapter->id = I2C_HW_IOP3XX;
|
||||
new_adapter->owner = THIS_MODULE;
|
||||
new_adapter->class = I2C_CLASS_HWMON;
|
||||
new_adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
|
||||
new_adapter->dev.parent = &pdev->dev;
|
||||
new_adapter->nr = pdev->id;
|
||||
|
||||
|
@ -251,7 +251,7 @@ static const struct i2c_algorithm smbus_algorithm = {
|
||||
|
||||
static struct i2c_adapter sch_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
@ -311,7 +311,7 @@ static struct i2c_adapter mpc_ops = {
|
||||
.name = "MPC adapter",
|
||||
.id = I2C_HW_MPC107,
|
||||
.algo = &mpc_algo,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.timeout = 1,
|
||||
};
|
||||
|
||||
|
@ -530,7 +530,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
|
||||
drv_data->adapter.id = I2C_HW_MV64XXX;
|
||||
drv_data->adapter.algo = &mv64xxx_i2c_algo;
|
||||
drv_data->adapter.owner = THIS_MODULE;
|
||||
drv_data->adapter.class = I2C_CLASS_HWMON;
|
||||
drv_data->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
|
||||
drv_data->adapter.timeout = pdata->timeout;
|
||||
drv_data->adapter.nr = pd->id;
|
||||
platform_set_drvdata(pd, drv_data);
|
||||
|
@ -350,7 +350,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
|
||||
}
|
||||
smbus->adapter.owner = THIS_MODULE;
|
||||
smbus->adapter.id = I2C_HW_SMBUS_NFORCE2;
|
||||
smbus->adapter.class = I2C_CLASS_HWMON;
|
||||
smbus->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
|
||||
smbus->adapter.algo = &smbus_algorithm;
|
||||
smbus->adapter.algo_data = smbus;
|
||||
smbus->adapter.dev.parent = &dev->dev;
|
||||
|
@ -205,7 +205,7 @@ static const struct i2c_algorithm ocores_algorithm = {
|
||||
static struct i2c_adapter ocores_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "i2c-ocores",
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &ocores_algorithm,
|
||||
};
|
||||
|
||||
|
@ -365,7 +365,7 @@ static int __devinit pasemi_smb_probe(struct pci_dev *dev,
|
||||
smbus->adapter.owner = THIS_MODULE;
|
||||
snprintf(smbus->adapter.name, sizeof(smbus->adapter.name),
|
||||
"PA Semi SMBus adapter at 0x%lx", smbus->base);
|
||||
smbus->adapter.class = I2C_CLASS_HWMON;
|
||||
smbus->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
|
||||
smbus->adapter.algo = &smbus_algorithm;
|
||||
smbus->adapter.algo_data = smbus;
|
||||
smbus->adapter.nr = PCI_FUNC(dev->devfn);
|
||||
|
@ -402,7 +402,7 @@ static const struct i2c_algorithm smbus_algorithm = {
|
||||
static struct i2c_adapter piix4_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SMBUS_PIIX4,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
@ -622,7 +622,7 @@ static struct i2c_algorithm pmcmsptwi_algo = {
|
||||
|
||||
static struct i2c_adapter pmcmsptwi_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &pmcmsptwi_algo,
|
||||
.name = DRV_NAME,
|
||||
};
|
||||
|
@ -590,7 +590,7 @@ static struct s3c24xx_i2c s3c24xx_i2c = {
|
||||
.owner = THIS_MODULE,
|
||||
.algo = &s3c24xx_i2c_algorithm,
|
||||
.retries = 2,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -156,7 +156,7 @@ static struct i2c_adapter sibyte_board_adapter[2] = {
|
||||
{
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SIBYTE,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = NULL,
|
||||
.algo_data = &sibyte_board_data[0],
|
||||
.name = "SiByte SMBus 0",
|
||||
@ -164,7 +164,7 @@ static struct i2c_adapter sibyte_board_adapter[2] = {
|
||||
{
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SIBYTE,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = NULL,
|
||||
.algo_data = &sibyte_board_data[1],
|
||||
.name = "SiByte SMBus 1",
|
||||
|
@ -362,7 +362,7 @@ static const struct i2c_algorithm smbus_algorithm = {
|
||||
static struct i2c_adapter sis5595_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SMBUS_SIS5595,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
@ -462,7 +462,7 @@ static const struct i2c_algorithm smbus_algorithm = {
|
||||
static struct i2c_adapter sis630_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SMBUS_SIS630,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
@ -244,7 +244,7 @@ static const struct i2c_algorithm smbus_algorithm = {
|
||||
static struct i2c_adapter sis96x_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SMBUS_SIS96X,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
@ -140,7 +140,7 @@ static const struct i2c_algorithm smbus_algorithm = {
|
||||
|
||||
static struct i2c_adapter stub_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &smbus_algorithm,
|
||||
.name = "SMBus stub driver",
|
||||
};
|
||||
|
@ -87,7 +87,7 @@ static struct i2c_algo_bit_data bit_data = {
|
||||
static struct i2c_adapter vt586b_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_B_VIA,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.name = "VIA i2c",
|
||||
.algo_data = &bit_data,
|
||||
};
|
||||
|
@ -311,7 +311,7 @@ static const struct i2c_algorithm smbus_algorithm = {
|
||||
static struct i2c_adapter vt596_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.id = I2C_HW_SMBUS_VIA2,
|
||||
.class = I2C_CLASS_HWMON,
|
||||
.class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
@ -442,7 +442,7 @@ static __init struct scx200_acb_iface *scx200_create_iface(const char *text,
|
||||
adapter->owner = THIS_MODULE;
|
||||
adapter->id = I2C_HW_SMBUS_SCX200;
|
||||
adapter->algo = &scx200_acb_algorithm;
|
||||
adapter->class = I2C_CLASS_HWMON;
|
||||
adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
|
||||
adapter->dev.parent = dev;
|
||||
|
||||
mutex_init(&iface->mutex);
|
||||
|
@ -353,6 +353,7 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
|
||||
#define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */
|
||||
#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */
|
||||
#define I2C_CLASS_SOUND (1<<6) /* sound devices */
|
||||
#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */
|
||||
#define I2C_CLASS_ALL (UINT_MAX) /* all of the above */
|
||||
|
||||
/* i2c_client_address_data is the struct for holding default client
|
||||
|
Loading…
Reference in New Issue
Block a user