Skip to content

Commit

Permalink
[PATCH] I2C: Kill i2c_algorithm.id (5/7)
Browse files Browse the repository at this point in the history
Merge the algorithm id part (16 upper bits) of the i2c adapters ids
into the definition of the adapters ids directly. After that, we don't
need to OR both ids together for each i2c_adapter structure.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jean Delvare authored and Greg Kroah-Hartman committed Sep 5, 2005
1 parent 1d8b9e1 commit c7a4653
Show file tree
Hide file tree
Showing 27 changed files with 95 additions and 106 deletions.
2 changes: 0 additions & 2 deletions drivers/i2c/algos/i2c-algo-bit.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,6 @@ int i2c_bit_add_bus(struct i2c_adapter *adap)
DEB2(dev_dbg(&adap->dev, "hw routines registered.\n"));

/* register new adapter to i2c module... */

adap->id |= I2C_ALGO_BIT;
adap->algo = &i2c_bit_algo;

adap->timeout = 100; /* default values, should */
Expand Down
2 changes: 0 additions & 2 deletions drivers/i2c/algos/i2c-algo-ite.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,6 @@ int i2c_iic_add_bus(struct i2c_adapter *adap)
adap->name));

/* register new adapter to i2c module... */

adap->id |= I2C_ALGO_IIC;
adap->algo = &iic_algo;

adap->timeout = 100; /* default values, should */
Expand Down
2 changes: 0 additions & 2 deletions drivers/i2c/algos/i2c-algo-pca.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,6 @@ int i2c_pca_add_bus(struct i2c_adapter *adap)
int rval;

/* register new adapter to i2c module... */

adap->id |= I2C_ALGO_PCA;
adap->algo = &pca_algo;

adap->timeout = 100; /* default values, should */
Expand Down
2 changes: 0 additions & 2 deletions drivers/i2c/algos/i2c-algo-pcf.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,6 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap)
DEB2(dev_dbg(&adap->dev, "hw routines registered.\n"));

/* register new adapter to i2c module... */

adap->id |= I2C_ALGO_PCF;
adap->algo = &pcf_algo;

adap->timeout = 100; /* default values, should */
Expand Down
1 change: 0 additions & 1 deletion drivers/i2c/algos/i2c-algo-sgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ static struct i2c_algorithm sgi_algo = {
*/
int i2c_sgi_add_bus(struct i2c_adapter *adap)
{
adap->id |= I2C_ALGO_SGI;
adap->algo = &sgi_algo;

return i2c_add_adapter(adap);
Expand Down
2 changes: 0 additions & 2 deletions drivers/i2c/algos/i2c-algo-sibyte.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ int i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed)
struct i2c_algo_sibyte_data *adap = i2c_adap->algo_data;

/* register new adapter to i2c module... */

i2c_adap->id |= I2C_ALGO_SIBYTE;
i2c_adap->algo = &i2c_sibyte_algo;

/* Set the frequency to 100 kHz */
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-ibm_iic.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){
adap = &dev->adap;
strcpy(adap->name, "IBM IIC");
i2c_set_adapdata(adap, dev);
adap->id = I2C_ALGO_OCP | I2C_HW_OCP;
adap->id = I2C_HW_OCP;
adap->algo = &iic_algo;
adap->client_register = NULL;
adap->client_unregister = NULL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-isa.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static struct i2c_algorithm isa_algorithm = {
/* There can only be one... */
static struct i2c_adapter isa_adapter = {
.owner = THIS_MODULE,
.id = I2C_ALGO_ISA | I2C_HW_ISA,
.id = I2C_HW_ISA,
.class = I2C_CLASS_HWMON,
.algo = &isa_algorithm,
.name = "ISA main adapter",
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-mpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static struct i2c_algorithm mpc_algo = {
static struct i2c_adapter mpc_ops = {
.owner = THIS_MODULE,
.name = "MPC adapter",
.id = I2C_ALGO_MPC107 | I2C_HW_MPC107,
.id = I2C_HW_MPC107,
.algo = &mpc_algo,
.class = I2C_CLASS_HWMON,
.timeout = 1,
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-mv64xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ mv64xxx_i2c_probe(struct device *dev)
drv_data->freq_m = pdata->freq_m;
drv_data->freq_n = pdata->freq_n;
drv_data->irq = platform_get_irq(pd, 0);
drv_data->adapter.id = I2C_ALGO_MV64XXX | I2C_HW_MV64XXX;
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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/bt832.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static int bt832_probe(struct i2c_adapter *adap)
if (adap->class & I2C_CLASS_TV_ANALOG)
return i2c_probe(adap, &addr_data, bt832_attach);
#else
if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848))
if (adap->id == I2C_HW_B_BT848)
return i2c_probe(adap, &addr_data, bt832_attach);
#endif
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/bttv-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ static struct i2c_adapter bttv_i2c_adap_hw_template = {
.class = I2C_CLASS_TV_ANALOG,
#endif
I2C_DEVNAME("bt878"),
.id = I2C_ALGO_BIT | I2C_HW_B_BT848 /* FIXME */,
.id = I2C_HW_B_BT848 /* FIXME */,
.algo = &bttv_algo,
.client_register = attach_inform,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/ir-kbd-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ static int ir_probe(struct i2c_adapter *adap)
struct i2c_client c; char buf; int i,rc;

switch (adap->id) {
case I2C_ALGO_BIT | I2C_HW_B_BT848:
case I2C_HW_B_BT848:
probe = probe_bttv;
break;
case I2C_ALGO_SAA7134:
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/video/ovcamchip/ov6x20.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ static int ov6x20_init(struct i2c_client *c)
DDEBUG(4, &c->dev, "entered");

switch (c->adapter->id) {
case I2C_ALGO_SMBUS | I2C_HW_SMBUS_OV511:
case I2C_HW_SMBUS_OV511:
rc = ov_write_regvals(c, regvals_init_6x20_511);
break;
case I2C_ALGO_SMBUS | I2C_HW_SMBUS_OV518:
case I2C_HW_SMBUS_OV518:
rc = ov_write_regvals(c, regvals_init_6x20_518);
break;
default:
Expand Down Expand Up @@ -338,7 +338,7 @@ static int ov6x20_mode_init(struct i2c_client *c, struct ovcamchip_window *win)
/******** Palette-specific regs ********/

/* OV518 needs 8 bit multiplexed in color mode, and 16 bit in B&W */
if (c->adapter->id == (I2C_ALGO_SMBUS | I2C_HW_SMBUS_OV518)) {
if (c->adapter->id == I2C_HW_SMBUS_OV518) {
if (win->format == VIDEO_PALETTE_GREY)
ov_write_mask(c, 0x13, 0x00, 0x20);
else
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/video/ovcamchip/ov6x30.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ static int ov6x30_mode_init(struct i2c_client *c, struct ovcamchip_window *win)
/******** Palette-specific regs ********/

if (win->format == VIDEO_PALETTE_GREY) {
if (c->adapter->id == (I2C_ALGO_SMBUS | I2C_HW_SMBUS_OV518)) {
if (c->adapter->id == I2C_HW_SMBUS_OV518) {
/* Do nothing - we're already in 8-bit mode */
} else {
ov_write_mask(c, 0x13, 0x20, 0x20);
Expand All @@ -313,7 +313,7 @@ static int ov6x30_mode_init(struct i2c_client *c, struct ovcamchip_window *win)
* Therefore, the OV6630 needs to be in 8-bit multiplexed
* output mode */

if (c->adapter->id == (I2C_ALGO_SMBUS | I2C_HW_SMBUS_OV518)) {
if (c->adapter->id == I2C_HW_SMBUS_OV518) {
/* Do nothing - we want to stay in 8-bit mode */
/* Warning: Messing with reg 0x13 breaks OV518 color */
} else {
Expand Down
8 changes: 4 additions & 4 deletions drivers/media/video/ovcamchip/ovcamchip_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ static int ovcamchip_attach(struct i2c_adapter *adap)
* attach to adapters that are known to contain OV camera chips. */

switch (adap->id) {
case (I2C_ALGO_SMBUS | I2C_HW_SMBUS_OV511):
case (I2C_ALGO_SMBUS | I2C_HW_SMBUS_OV518):
case (I2C_ALGO_SMBUS | I2C_HW_SMBUS_OVFX2):
case (I2C_ALGO_SMBUS | I2C_HW_SMBUS_W9968CF):
case I2C_HW_SMBUS_OV511:
case I2C_HW_SMBUS_OV518:
case I2C_HW_SMBUS_OVFX2:
case I2C_HW_SMBUS_W9968CF:
PDEBUG(1, "Adapter ID 0x%06x accepted", adap->id);
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/tda7432.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static int tda7432_probe(struct i2c_adapter *adap)
if (adap->class & I2C_CLASS_TV_ANALOG)
return i2c_probe(adap, &addr_data, tda7432_attach);
#else
if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848))
if (adap->id == I2C_HW_B_BT848)
return i2c_probe(adap, &addr_data, tda7432_attach);
#endif
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/tda9875.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static int tda9875_probe(struct i2c_adapter *adap)
if (adap->class & I2C_CLASS_TV_ANALOG)
return i2c_probe(adap, &addr_data, tda9875_attach);
#else
if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848))
if (adap->id == I2C_HW_B_BT848)
return i2c_probe(adap, &addr_data, tda9875_attach);
#endif
return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/video/tda9887.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,8 @@ static int tda9887_probe(struct i2c_adapter *adap)
return i2c_probe(adap, &addr_data, tda9887_attach);
#else
switch (adap->id) {
case I2C_ALGO_BIT | I2C_HW_B_BT848:
case I2C_ALGO_BIT | I2C_HW_B_RIVA:
case I2C_HW_B_BT848:
case I2C_HW_B_RIVA:
case I2C_ALGO_SAA7134:
return i2c_probe(adap, &addr_data, tda9887_attach);
break;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/tuner-3036.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static int
tuner_probe(struct i2c_adapter *adap)
{
this_adap = 0;
if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_LP))
if (adap->id == I2C_HW_B_LP)
return i2c_probe(adap, &addr_data, tuner_attach);
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/video/tvaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ static int tda8425_initialize(struct CHIPSTATE *chip)
/* extern */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF,
/* off */ TDA8425_S1_OFF, /* on */ TDA8425_S1_CH2};

if (chip->c.adapter->id == (I2C_ALGO_BIT | I2C_HW_B_RIVA)) {
if (chip->c.adapter->id == I2C_HW_B_RIVA) {
memcpy (desc->inputmap, inputmap, sizeof (inputmap));
}
return 0;
Expand Down Expand Up @@ -1555,8 +1555,8 @@ static int chip_probe(struct i2c_adapter *adap)
return i2c_probe(adap, &addr_data, chip_attach);
#else
switch (adap->id) {
case I2C_ALGO_BIT | I2C_HW_B_BT848:
case I2C_ALGO_BIT | I2C_HW_B_RIVA:
case I2C_HW_B_BT848:
case I2C_HW_B_RIVA:
case I2C_ALGO_SAA7134:
return i2c_probe(adap, &addr_data, chip_attach);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/tveeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ static int
tveeprom_attach_adapter (struct i2c_adapter *adapter)
{
dprintk(1,"%s: id 0x%x\n",__FUNCTION__,adapter->id);
if (adapter->id != (I2C_ALGO_BIT | I2C_HW_B_BT848))
if (adapter->id != I2C_HW_B_BT848)
return 0;
return i2c_probe(adapter, &addr_data, tveeprom_detect_client);
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/video/tvmixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ static int tvmixer_clients(struct i2c_client *client)
#else
/* TV card ??? */
switch (client->adapter->id) {
case I2C_ALGO_BIT | I2C_HW_SMBUS_VOODOO3:
case I2C_ALGO_BIT | I2C_HW_B_BT848:
case I2C_ALGO_BIT | I2C_HW_B_RIVA:
case I2C_HW_SMBUS_VOODOO3:
case I2C_HW_B_BT848:
case I2C_HW_B_RIVA:
/* ok, have a look ... */
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/media/w9968cf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ static int w9968cf_i2c_init(struct w9968cf_device* cam)
};

static struct i2c_adapter adap = {
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_W9968CF,
.id = I2C_HW_SMBUS_W9968CF,
.class = I2C_CLASS_CAM_DIGITAL,
.owner = THIS_MODULE,
.client_register = w9968cf_i2c_attach_inform,
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/matrox/matroxfb_maven.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ ERROR0:;
}

static int maven_attach_adapter(struct i2c_adapter* adapter) {
if (adapter->id == (I2C_ALGO_BIT | I2C_HW_B_G400))
if (adapter->id == I2C_HW_B_G400)
return i2c_probe(adapter, &addr_data, &maven_detect_client);
return 0;
}
Expand Down
Loading

0 comments on commit c7a4653

Please sign in to comment.