Skip to content

Commit

Permalink
Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare…
Browse files Browse the repository at this point in the history
…-2.6

* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  i2c: Use snprintf to set adapter names
  Input: apanel - convert to new i2c binding
  i2c: Drop I2C_CLASS_CAM_DIGITAL
  i2c: Drop I2C_CLASS_CAM_ANALOG and I2C_CLASS_SOUND
  i2c: Drop I2C_CLASS_ALL
  i2c: Get rid of remaining bus_id access
  i2c: Replace bus_id with dev_name(), dev_set_name()
  • Loading branch information
Linus Torvalds committed Jan 7, 2009
2 parents 0824990 + 66c7acf commit fa7b906
Show file tree
Hide file tree
Showing 19 changed files with 98 additions and 84 deletions.
4 changes: 2 additions & 2 deletions drivers/i2c/busses/i2c-ali1563.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ static int __devinit ali1563_probe(struct pci_dev * dev,
if ((error = ali1563_setup(dev)))
goto exit;
ali1563_adapter.dev.parent = &dev->dev;
sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x",
ali1563_smba);
snprintf(ali1563_adapter.name, sizeof(ali1563_adapter.name),
"SMBus ALi 1563 Adapter @ %04x", ali1563_smba);
if ((error = i2c_add_adapter(&ali1563_adapter)))
goto exit_shutdown;
return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/i2c/busses/i2c-amd756-s4882.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ static int __init amd756_s4882_init(void)
for (i = 1; i < 5; i++) {
s4882_algo[i] = *(amd756_smbus.algo);
s4882_adapter[i] = amd756_smbus;
sprintf(s4882_adapter[i].name,
"SMBus 8111 adapter (CPU%d)", i-1);
snprintf(s4882_adapter[i].name, sizeof(s4882_adapter[i].name),
"SMBus 8111 adapter (CPU%d)", i-1);
s4882_adapter[i].algo = s4882_algo+i;
s4882_adapter[i].dev.parent = amd756_smbus.dev.parent;
}
Expand Down
5 changes: 3 additions & 2 deletions drivers/i2c/busses/i2c-amd756.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,9 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
/* set up the sysfs linkage to our parent device */
amd756_smbus.dev.parent = &pdev->dev;

sprintf(amd756_smbus.name, "SMBus %s adapter at %04x",
chipname[id->driver_data], amd756_ioport);
snprintf(amd756_smbus.name, sizeof(amd756_smbus.name),
"SMBus %s adapter at %04x", chipname[id->driver_data],
amd756_ioport);

error = i2c_add_adapter(&amd756_smbus);
if (error) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-at91.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static int __devinit at91_i2c_probe(struct platform_device *pdev)
rc = -ENOMEM;
goto fail2;
}
sprintf(adapter->name, "AT91");
snprintf(adapter->name, sizeof(adapter->name), "AT91");
adapter->algo = &at91_algorithm;
adapter->class = I2C_CLASS_HWMON;
adapter->dev.parent = &pdev->dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-bfin-twi.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name));
p_adap->algo = &bfin_twi_algorithm;
p_adap->algo_data = iface;
p_adap->class = I2C_CLASS_ALL;
p_adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
p_adap->dev.parent = &pdev->dev;

rc = peripheral_request_list(pin_req[pdev->id], "i2c-bfin-twi");
Expand Down
50 changes: 49 additions & 1 deletion drivers/i2c/busses/i2c-i801.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/acpi.h>
#include <asm/io.h>
#include <linux/io.h>

/* I801 SMBus address offsets */
#define SMBHSTSTS (0 + i801_smba)
Expand Down Expand Up @@ -583,6 +583,40 @@ static struct pci_device_id i801_ids[] = {

MODULE_DEVICE_TABLE (pci, i801_ids);

#if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE
static unsigned char apanel_addr;

/* Scan the system ROM for the signature "FJKEYINF" */
static __init const void __iomem *bios_signature(const void __iomem *bios)
{
ssize_t offset;
const unsigned char signature[] = "FJKEYINF";

for (offset = 0; offset < 0x10000; offset += 0x10) {
if (check_signature(bios + offset, signature,
sizeof(signature)-1))
return bios + offset;
}
return NULL;
}

static void __init input_apanel_init(void)
{
void __iomem *bios;
const void __iomem *p;

bios = ioremap(0xF0000, 0x10000); /* Can't fail */
p = bios_signature(bios);
if (p) {
/* just use the first address */
apanel_addr = readb(p + 8 + 3) >> 1;
}
iounmap(bios);
}
#else
static void __init input_apanel_init(void) {}
#endif

static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
unsigned char temp;
Expand Down Expand Up @@ -667,6 +701,19 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
dev_err(&dev->dev, "Failed to add SMBus adapter\n");
goto exit_release;
}

/* Register optional slaves */
#if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE
if (apanel_addr) {
struct i2c_board_info info;

memset(&info, 0, sizeof(struct i2c_board_info));
info.addr = apanel_addr;
strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE);
i2c_new_device(&i801_adapter, &info);
}
#endif

return 0;

exit_release:
Expand Down Expand Up @@ -717,6 +764,7 @@ static struct pci_driver i801_driver = {

static int __init i2c_i801_init(void)
{
input_apanel_init();
return pci_register_driver(&i801_driver);
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/i2c/busses/i2c-pxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,10 +1076,10 @@ static int i2c_pxa_probe(struct platform_device *dev)

#ifdef CONFIG_I2C_PXA_SLAVE
printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n",
i2c->adap.dev.bus_id, i2c->slave_addr);
dev_name(&i2c->adap.dev), i2c->slave_addr);
#else
printk(KERN_INFO "I2C: %s: PXA I2C adapter\n",
i2c->adap.dev.bus_id);
dev_name(&i2c->adap.dev));
#endif
return 0;

Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, i2c);

dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id);
dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev));
return 0;

err_cpufreq:
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-sh7760.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ static int __devinit sh7760_i2c_probe(struct platform_device *pdev)

id->adap.nr = pdev->id;
id->adap.algo = &sh7760_i2c_algo;
id->adap.class = I2C_CLASS_ALL;
id->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
id->adap.retries = 3;
id->adap.algo_data = id;
id->adap.dev.parent = &pdev->dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-sh_mobile.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ static int sh_mobile_i2c_hook_irqs(struct platform_device *dev, int hook)
while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) {
for (n = res->start; hook && n <= res->end; n++) {
if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED,
dev->dev.bus_id, dev))
dev_name(&dev->dev), dev))
goto rollback;
}
k++;
Expand Down
4 changes: 2 additions & 2 deletions drivers/i2c/busses/i2c-sis5595.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_
/* set up the sysfs linkage to our parent device */
sis5595_adapter.dev.parent = &dev->dev;

sprintf(sis5595_adapter.name, "SMBus SIS5595 adapter at %04x",
sis5595_base + SMB_INDEX);
snprintf(sis5595_adapter.name, sizeof(sis5595_adapter.name),
"SMBus SIS5595 adapter at %04x", sis5595_base + SMB_INDEX);
err = i2c_add_adapter(&sis5595_adapter);
if (err) {
release_region(sis5595_base + SMB_INDEX, 2);
Expand Down
4 changes: 2 additions & 2 deletions drivers/i2c/busses/i2c-sis630.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,8 @@ static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_i
/* set up the sysfs linkage to our parent device */
sis630_adapter.dev.parent = &dev->dev;

sprintf(sis630_adapter.name, "SMBus SIS630 adapter at %04x",
acpi_base + SMB_STS);
snprintf(sis630_adapter.name, sizeof(sis630_adapter.name),
"SMBus SIS630 adapter at %04x", acpi_base + SMB_STS);

return i2c_add_adapter(&sis630_adapter);
}
Expand Down
8 changes: 4 additions & 4 deletions drivers/i2c/i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
pr_debug("I2C adapter driver [%s] forgot to specify "
"physical device\n", adap->name);
}
sprintf(adap->dev.bus_id, "i2c-%d", adap->nr);
dev_set_name(&adap->dev, "i2c-%d", adap->nr);
adap->dev.release = &i2c_adapter_dev_release;
adap->dev.class = &i2c_adapter_class;
res = device_register(&adap->dev);
Expand Down Expand Up @@ -845,8 +845,8 @@ int i2c_attach_client(struct i2c_client *client)
} else
client->dev.release = i2c_client_dev_release;

snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id),
"%d-%04x", i2c_adapter_id(adapter), client->addr);
dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adapter),
client->addr);
res = device_register(&client->dev);
if (res)
goto out_err;
Expand All @@ -856,7 +856,7 @@ int i2c_attach_client(struct i2c_client *client)
mutex_unlock(&adapter->clist_lock);

dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n",
client->name, client->dev.bus_id);
client->name, dev_name(&client->dev));

if (adapter->client_register) {
if (adapter->client_register(client)) {
Expand Down
Loading

0 comments on commit fa7b906

Please sign in to comment.