]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
i2c: Let bus drivers add SPD to their class
authorJean Delvare <khali@linux-fr.org>
Mon, 14 Jul 2008 20:38:29 +0000 (22:38 +0200)
committerJean Delvare <khali@mahadeva.delvare>
Mon, 14 Jul 2008 20:38:29 +0000 (22:38 +0200)
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>
29 files changed:
drivers/i2c/busses/i2c-ali1535.c
drivers/i2c/busses/i2c-ali1563.c
drivers/i2c/busses/i2c-ali15x3.c
drivers/i2c/busses/i2c-amd756.c
drivers/i2c/busses/i2c-amd8111.c
drivers/i2c/busses/i2c-cpm.c
drivers/i2c/busses/i2c-elektor.c
drivers/i2c/busses/i2c-gpio.c
drivers/i2c/busses/i2c-i801.c
drivers/i2c/busses/i2c-ibm_iic.c
drivers/i2c/busses/i2c-iop3xx.c
drivers/i2c/busses/i2c-isch.c
drivers/i2c/busses/i2c-mpc.c
drivers/i2c/busses/i2c-mv64xxx.c
drivers/i2c/busses/i2c-nforce2.c
drivers/i2c/busses/i2c-ocores.c
drivers/i2c/busses/i2c-pasemi.c
drivers/i2c/busses/i2c-piix4.c
drivers/i2c/busses/i2c-pmcmsp.c
drivers/i2c/busses/i2c-s3c2410.c
drivers/i2c/busses/i2c-sibyte.c
drivers/i2c/busses/i2c-sis5595.c
drivers/i2c/busses/i2c-sis630.c
drivers/i2c/busses/i2c-sis96x.c
drivers/i2c/busses/i2c-stub.c
drivers/i2c/busses/i2c-via.c
drivers/i2c/busses/i2c-viapro.c
drivers/i2c/busses/scx200_acb.c
include/linux/i2c.h

index 704436cdec8e62769e2a69ed39a7302e7e2c3fab..8d1d90ab3a90343ff8bd0aba92e058c5ad9ee5b0 100644 (file)
@@ -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,
 };
 
index da5a382eee93f9b94d1fb9bff4d20313f912ae78..4b55ae19db8d3c43cc85a72dc37504f7d49eebb6 100644 (file)
@@ -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,
 };
 
index 7b029b147a8e70a95b509440953dca7dc2468d09..e922c3950fcdc4081c26fa3ca122f4465b116ead 100644 (file)
@@ -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,
 };
 
index f0baea62067d3d59ed004ea75efd5833cd413665..bd4f6380fabe61e12827597565199f234d4eeb24 100644 (file)
@@ -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,
 };
 
index a4f687915de1a2d0d6cbaeeeaac0b4c3f537b156..0e18fe8460103e26eaac8bc68d6dbbe873079c77 100644 (file)
@@ -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;
 
index 53af744a91c12d249c152e56f8ad6d997c90289d..8164de1f4d72aba3a411f88f5d187e6d0c137f16 100644 (file)
@@ -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)
index b7a9977b025f31a492d632f8b57cb49930f05466..c251cf21a62b3b25f57492e2a2cfa976bc2e3bd6 100644 (file)
@@ -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",
index 7c1b762aa681fc727312c0e0c1db08dbff0c2c04..79b455a1f090587c4c63d5b29b76d8474c81b122 100644 (file)
@@ -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;
 
        /*
index 213119211e58711413e99bf5c3427b9ef154ec3d..9717ffe12921fc5ffdf16d4035160a93d1eaecab 100644 (file)
@@ -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,
 };
 
index 85dbf34382e1f54a3d964a2f71abf4f214457656..6f7bfdec3c6910e23fcae17cab71c91692fcb2e7 100644 (file)
@@ -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;
index 39884e7975945e8954ed4bb8f1e8194fab5fd895..fc2714ac0c0f4ba865584f5012fce1dc563f3d06 100644 (file)
@@ -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;
 
index c9cd46b2269227bf5df160a5dea98c98bc5da87a..8d648911a7f5d137bf87b806800a03879a98d8ce 100644 (file)
@@ -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,
 };
 
index a076129de7e811acb2434864ef2d48fccbeafa3b..10b9342a36c21241bb3c0ca36960801148053239 100644 (file)
@@ -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,
 };
 
index 036e6a883e6788e1564a56ae04afb227971681d6..9e8118d2fe64cccfa54e745337982569e0710064 100644 (file)
@@ -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);
index 081fdf3393f447a63d47bcafb34f8e953e09b114..2654f20d3a628ed4c8dd14a6910aaef3a0fc4952 100644 (file)
@@ -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;
index f145692cbb76ad649901ccc3553443804bde3941..51ca79bf64807fef0892a55851c8b401d6482207 100644 (file)
@@ -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,
 };
 
index 1603c81e39d472e0b45644477db450aa3e26382e..adf0fbb902f0850fb77a77b2bdee30a6bff7e206 100644 (file)
@@ -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);
index 2bde47509e1a4c4243de0dcc4f81eead5deb6561..85d69f3e624f2a7faf8116a7e8121f55830d8648 100644 (file)
@@ -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,
 };
 
index 63b3e2c11cff1a17ac67b2b21b39d49851c5143a..dcf2045b5222b44aac99b568f7170701ecf0ae78 100644 (file)
@@ -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,
 };
index 9e8c875437bec533ec4e32579602f31f4336bbe9..007390ad9810555b0fe7f2ba6077445601ec919b 100644 (file)
@@ -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,
        },
 };
 
index 114634da6c6e9f3a7bd7ca77bf04476fc1c2818c..ac8822e7a5b482a5963bade401bbf62e71e88c7a 100644 (file)
@@ -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",
index 328441bb547065a35fec28167e0f04df28586009..f76944b384f57c279d6dd0ae0ac5370778ee612b 100644 (file)
@@ -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,
 };
 
index d7e6ff3e018737af93e2f083db1d153a14f93a48..eb2b2181fed7e2763531128cabeec4a1960ae422 100644 (file)
@@ -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,
 };
 
index cde8e5880368afd23a6d2a551f441fbe01e9b7f7..413e9e477723dfc53aca0674da678a7d7b096c32 100644 (file)
@@ -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,
 };
 
index e37ccd80f77a3b22d8bd488b944d50c8ee972515..1b7b2af94036ca448ff226f49bd1e14ff45068c4 100644 (file)
@@ -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",
 };
index 61716f6b14dcd2435c1b65f0fe27e05fc4f090cb..6517f8a6d911b9d5b0dc019a881ddf195f56acde 100644 (file)
@@ -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,
 };
index c611905df009bcc9521035c4a27a831da5f301f1..7957ce51589156c4089b8f6a157216fdf1631d44 100644 (file)
@@ -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,
 };
 
index 61abe0f33255291ffa7e274f0aed3a8f68f283d6..ed794b145a115bb4d235ded80ffd66dfc3e67668 100644 (file)
@@ -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);
index 145797fe6a310b128f42396619264638f131c71e..839d0ea3dca36d6e6a0791ca864e1922351274b8 100644 (file)
@@ -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