diff options
-rw-r--r-- | drivers/i2c/busses/i2c-ali1563.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-amd756-s4882.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-amd756.c | 5 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-at91.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-bfin-twi.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 50 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-s3c2410.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-sh7760.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-sh_mobile.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-sis5595.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-sis630.c | 4 | ||||
-rw-r--r-- | drivers/i2c/i2c-core.c | 8 | ||||
-rw-r--r-- | drivers/input/misc/apanel.c | 81 | ||||
-rw-r--r-- | drivers/media/video/cafe_ccic.c | 1 | ||||
-rw-r--r-- | drivers/media/video/ov7670.c | 1 | ||||
-rw-r--r-- | drivers/media/video/ovcamchip/ovcamchip_core.c | 1 | ||||
-rw-r--r-- | drivers/media/video/w9968cf.c | 1 | ||||
-rw-r--r-- | include/linux/i2c.h | 4 |
19 files changed, 98 insertions, 84 deletions
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c index fc3e5b026423..dd9e796fad69 100644 --- a/drivers/i2c/busses/i2c-ali1563.c +++ b/drivers/i2c/busses/i2c-ali1563.c | |||
@@ -399,8 +399,8 @@ static int __devinit ali1563_probe(struct pci_dev * dev, | |||
399 | if ((error = ali1563_setup(dev))) | 399 | if ((error = ali1563_setup(dev))) |
400 | goto exit; | 400 | goto exit; |
401 | ali1563_adapter.dev.parent = &dev->dev; | 401 | ali1563_adapter.dev.parent = &dev->dev; |
402 | sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x", | 402 | snprintf(ali1563_adapter.name, sizeof(ali1563_adapter.name), |
403 | ali1563_smba); | 403 | "SMBus ALi 1563 Adapter @ %04x", ali1563_smba); |
404 | if ((error = i2c_add_adapter(&ali1563_adapter))) | 404 | if ((error = i2c_add_adapter(&ali1563_adapter))) |
405 | goto exit_shutdown; | 405 | goto exit_shutdown; |
406 | return 0; | 406 | return 0; |
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c index 8ba2bcf727d3..378fcb5d5783 100644 --- a/drivers/i2c/busses/i2c-amd756-s4882.c +++ b/drivers/i2c/busses/i2c-amd756-s4882.c | |||
@@ -197,8 +197,8 @@ static int __init amd756_s4882_init(void) | |||
197 | for (i = 1; i < 5; i++) { | 197 | for (i = 1; i < 5; i++) { |
198 | s4882_algo[i] = *(amd756_smbus.algo); | 198 | s4882_algo[i] = *(amd756_smbus.algo); |
199 | s4882_adapter[i] = amd756_smbus; | 199 | s4882_adapter[i] = amd756_smbus; |
200 | sprintf(s4882_adapter[i].name, | 200 | snprintf(s4882_adapter[i].name, sizeof(s4882_adapter[i].name), |
201 | "SMBus 8111 adapter (CPU%d)", i-1); | 201 | "SMBus 8111 adapter (CPU%d)", i-1); |
202 | s4882_adapter[i].algo = s4882_algo+i; | 202 | s4882_adapter[i].algo = s4882_algo+i; |
203 | s4882_adapter[i].dev.parent = amd756_smbus.dev.parent; | 203 | s4882_adapter[i].dev.parent = amd756_smbus.dev.parent; |
204 | } | 204 | } |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 424dad6f18d8..36bee5b9c952 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -380,8 +380,9 @@ static int __devinit amd756_probe(struct pci_dev *pdev, | |||
380 | /* set up the sysfs linkage to our parent device */ | 380 | /* set up the sysfs linkage to our parent device */ |
381 | amd756_smbus.dev.parent = &pdev->dev; | 381 | amd756_smbus.dev.parent = &pdev->dev; |
382 | 382 | ||
383 | sprintf(amd756_smbus.name, "SMBus %s adapter at %04x", | 383 | snprintf(amd756_smbus.name, sizeof(amd756_smbus.name), |
384 | chipname[id->driver_data], amd756_ioport); | 384 | "SMBus %s adapter at %04x", chipname[id->driver_data], |
385 | amd756_ioport); | ||
385 | 386 | ||
386 | error = i2c_add_adapter(&amd756_smbus); | 387 | error = i2c_add_adapter(&amd756_smbus); |
387 | if (error) { | 388 | if (error) { |
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 9efb02137254..67d9dc5b351b 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c | |||
@@ -222,7 +222,7 @@ static int __devinit at91_i2c_probe(struct platform_device *pdev) | |||
222 | rc = -ENOMEM; | 222 | rc = -ENOMEM; |
223 | goto fail2; | 223 | goto fail2; |
224 | } | 224 | } |
225 | sprintf(adapter->name, "AT91"); | 225 | snprintf(adapter->name, sizeof(adapter->name), "AT91"); |
226 | adapter->algo = &at91_algorithm; | 226 | adapter->algo = &at91_algorithm; |
227 | adapter->class = I2C_CLASS_HWMON; | 227 | adapter->class = I2C_CLASS_HWMON; |
228 | adapter->dev.parent = &pdev->dev; | 228 | adapter->dev.parent = &pdev->dev; |
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c index 3c855ff2992f..3fd2c417c1e0 100644 --- a/drivers/i2c/busses/i2c-bfin-twi.c +++ b/drivers/i2c/busses/i2c-bfin-twi.c | |||
@@ -656,7 +656,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) | |||
656 | strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name)); | 656 | strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name)); |
657 | p_adap->algo = &bfin_twi_algorithm; | 657 | p_adap->algo = &bfin_twi_algorithm; |
658 | p_adap->algo_data = iface; | 658 | p_adap->algo_data = iface; |
659 | p_adap->class = I2C_CLASS_ALL; | 659 | p_adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; |
660 | p_adap->dev.parent = &pdev->dev; | 660 | p_adap->dev.parent = &pdev->dev; |
661 | 661 | ||
662 | rc = peripheral_request_list(pin_req[pdev->id], "i2c-bfin-twi"); | 662 | rc = peripheral_request_list(pin_req[pdev->id], "i2c-bfin-twi"); |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 5123eb69a971..526625eaa84b 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -64,7 +64,7 @@ | |||
64 | #include <linux/init.h> | 64 | #include <linux/init.h> |
65 | #include <linux/i2c.h> | 65 | #include <linux/i2c.h> |
66 | #include <linux/acpi.h> | 66 | #include <linux/acpi.h> |
67 | #include <asm/io.h> | 67 | #include <linux/io.h> |
68 | 68 | ||
69 | /* I801 SMBus address offsets */ | 69 | /* I801 SMBus address offsets */ |
70 | #define SMBHSTSTS (0 + i801_smba) | 70 | #define SMBHSTSTS (0 + i801_smba) |
@@ -583,6 +583,40 @@ static struct pci_device_id i801_ids[] = { | |||
583 | 583 | ||
584 | MODULE_DEVICE_TABLE (pci, i801_ids); | 584 | MODULE_DEVICE_TABLE (pci, i801_ids); |
585 | 585 | ||
586 | #if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE | ||
587 | static unsigned char apanel_addr; | ||
588 | |||
589 | /* Scan the system ROM for the signature "FJKEYINF" */ | ||
590 | static __init const void __iomem *bios_signature(const void __iomem *bios) | ||
591 | { | ||
592 | ssize_t offset; | ||
593 | const unsigned char signature[] = "FJKEYINF"; | ||
594 | |||
595 | for (offset = 0; offset < 0x10000; offset += 0x10) { | ||
596 | if (check_signature(bios + offset, signature, | ||
597 | sizeof(signature)-1)) | ||
598 | return bios + offset; | ||
599 | } | ||
600 | return NULL; | ||
601 | } | ||
602 | |||
603 | static void __init input_apanel_init(void) | ||
604 | { | ||
605 | void __iomem *bios; | ||
606 | const void __iomem *p; | ||
607 | |||
608 | bios = ioremap(0xF0000, 0x10000); /* Can't fail */ | ||
609 | p = bios_signature(bios); | ||
610 | if (p) { | ||
611 | /* just use the first address */ | ||
612 | apanel_addr = readb(p + 8 + 3) >> 1; | ||
613 | } | ||
614 | iounmap(bios); | ||
615 | } | ||
616 | #else | ||
617 | static void __init input_apanel_init(void) {} | ||
618 | #endif | ||
619 | |||
586 | static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id) | 620 | static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id) |
587 | { | 621 | { |
588 | unsigned char temp; | 622 | unsigned char temp; |
@@ -667,6 +701,19 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id | |||
667 | dev_err(&dev->dev, "Failed to add SMBus adapter\n"); | 701 | dev_err(&dev->dev, "Failed to add SMBus adapter\n"); |
668 | goto exit_release; | 702 | goto exit_release; |
669 | } | 703 | } |
704 | |||
705 | /* Register optional slaves */ | ||
706 | #if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE | ||
707 | if (apanel_addr) { | ||
708 | struct i2c_board_info info; | ||
709 | |||
710 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
711 | info.addr = apanel_addr; | ||
712 | strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE); | ||
713 | i2c_new_device(&i801_adapter, &info); | ||
714 | } | ||
715 | #endif | ||
716 | |||
670 | return 0; | 717 | return 0; |
671 | 718 | ||
672 | exit_release: | 719 | exit_release: |
@@ -717,6 +764,7 @@ static struct pci_driver i801_driver = { | |||
717 | 764 | ||
718 | static int __init i2c_i801_init(void) | 765 | static int __init i2c_i801_init(void) |
719 | { | 766 | { |
767 | input_apanel_init(); | ||
720 | return pci_register_driver(&i801_driver); | 768 | return pci_register_driver(&i801_driver); |
721 | } | 769 | } |
722 | 770 | ||
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 587f5b2380d4..6af68146c342 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -1076,10 +1076,10 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
1076 | 1076 | ||
1077 | #ifdef CONFIG_I2C_PXA_SLAVE | 1077 | #ifdef CONFIG_I2C_PXA_SLAVE |
1078 | printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n", | 1078 | printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n", |
1079 | i2c->adap.dev.bus_id, i2c->slave_addr); | 1079 | dev_name(&i2c->adap.dev), i2c->slave_addr); |
1080 | #else | 1080 | #else |
1081 | printk(KERN_INFO "I2C: %s: PXA I2C adapter\n", | 1081 | printk(KERN_INFO "I2C: %s: PXA I2C adapter\n", |
1082 | i2c->adap.dev.bus_id); | 1082 | dev_name(&i2c->adap.dev)); |
1083 | #endif | 1083 | #endif |
1084 | return 0; | 1084 | return 0; |
1085 | 1085 | ||
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index f69f91ffb469..5b7f95641ba4 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -906,7 +906,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
906 | 906 | ||
907 | platform_set_drvdata(pdev, i2c); | 907 | platform_set_drvdata(pdev, i2c); |
908 | 908 | ||
909 | dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id); | 909 | dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); |
910 | return 0; | 910 | return 0; |
911 | 911 | ||
912 | err_cpufreq: | 912 | err_cpufreq: |
diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c index 5e0e254976de..baa28b73ae42 100644 --- a/drivers/i2c/busses/i2c-sh7760.c +++ b/drivers/i2c/busses/i2c-sh7760.c | |||
@@ -475,7 +475,7 @@ static int __devinit sh7760_i2c_probe(struct platform_device *pdev) | |||
475 | 475 | ||
476 | id->adap.nr = pdev->id; | 476 | id->adap.nr = pdev->id; |
477 | id->adap.algo = &sh7760_i2c_algo; | 477 | id->adap.algo = &sh7760_i2c_algo; |
478 | id->adap.class = I2C_CLASS_ALL; | 478 | id->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD; |
479 | id->adap.retries = 3; | 479 | id->adap.retries = 3; |
480 | id->adap.algo_data = id; | 480 | id->adap.algo_data = id; |
481 | id->adap.dev.parent = &pdev->dev; | 481 | id->adap.dev.parent = &pdev->dev; |
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 6c3d60b939bf..1c01083b01b5 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c | |||
@@ -500,7 +500,7 @@ static int sh_mobile_i2c_hook_irqs(struct platform_device *dev, int hook) | |||
500 | while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) { | 500 | while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) { |
501 | for (n = res->start; hook && n <= res->end; n++) { | 501 | for (n = res->start; hook && n <= res->end; n++) { |
502 | if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED, | 502 | if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED, |
503 | dev->dev.bus_id, dev)) | 503 | dev_name(&dev->dev), dev)) |
504 | goto rollback; | 504 | goto rollback; |
505 | } | 505 | } |
506 | k++; | 506 | k++; |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index dfc2d5eb6a68..8ce2daff985c 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -389,8 +389,8 @@ static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_ | |||
389 | /* set up the sysfs linkage to our parent device */ | 389 | /* set up the sysfs linkage to our parent device */ |
390 | sis5595_adapter.dev.parent = &dev->dev; | 390 | sis5595_adapter.dev.parent = &dev->dev; |
391 | 391 | ||
392 | sprintf(sis5595_adapter.name, "SMBus SIS5595 adapter at %04x", | 392 | snprintf(sis5595_adapter.name, sizeof(sis5595_adapter.name), |
393 | sis5595_base + SMB_INDEX); | 393 | "SMBus SIS5595 adapter at %04x", sis5595_base + SMB_INDEX); |
394 | err = i2c_add_adapter(&sis5595_adapter); | 394 | err = i2c_add_adapter(&sis5595_adapter); |
395 | if (err) { | 395 | if (err) { |
396 | release_region(sis5595_base + SMB_INDEX, 2); | 396 | release_region(sis5595_base + SMB_INDEX, 2); |
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index e7c4b790da54..9c9c016ff2b5 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c | |||
@@ -487,8 +487,8 @@ static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_i | |||
487 | /* set up the sysfs linkage to our parent device */ | 487 | /* set up the sysfs linkage to our parent device */ |
488 | sis630_adapter.dev.parent = &dev->dev; | 488 | sis630_adapter.dev.parent = &dev->dev; |
489 | 489 | ||
490 | sprintf(sis630_adapter.name, "SMBus SIS630 adapter at %04x", | 490 | snprintf(sis630_adapter.name, sizeof(sis630_adapter.name), |
491 | acpi_base + SMB_STS); | 491 | "SMBus SIS630 adapter at %04x", acpi_base + SMB_STS); |
492 | 492 | ||
493 | return i2c_add_adapter(&sis630_adapter); | 493 | return i2c_add_adapter(&sis630_adapter); |
494 | } | 494 | } |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index c6a63f46bc15..b1c9abe24c7b 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -459,7 +459,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap) | |||
459 | pr_debug("I2C adapter driver [%s] forgot to specify " | 459 | pr_debug("I2C adapter driver [%s] forgot to specify " |
460 | "physical device\n", adap->name); | 460 | "physical device\n", adap->name); |
461 | } | 461 | } |
462 | sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); | 462 | dev_set_name(&adap->dev, "i2c-%d", adap->nr); |
463 | adap->dev.release = &i2c_adapter_dev_release; | 463 | adap->dev.release = &i2c_adapter_dev_release; |
464 | adap->dev.class = &i2c_adapter_class; | 464 | adap->dev.class = &i2c_adapter_class; |
465 | res = device_register(&adap->dev); | 465 | res = device_register(&adap->dev); |
@@ -845,8 +845,8 @@ int i2c_attach_client(struct i2c_client *client) | |||
845 | } else | 845 | } else |
846 | client->dev.release = i2c_client_dev_release; | 846 | client->dev.release = i2c_client_dev_release; |
847 | 847 | ||
848 | snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), | 848 | dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adapter), |
849 | "%d-%04x", i2c_adapter_id(adapter), client->addr); | 849 | client->addr); |
850 | res = device_register(&client->dev); | 850 | res = device_register(&client->dev); |
851 | if (res) | 851 | if (res) |
852 | goto out_err; | 852 | goto out_err; |
@@ -856,7 +856,7 @@ int i2c_attach_client(struct i2c_client *client) | |||
856 | mutex_unlock(&adapter->clist_lock); | 856 | mutex_unlock(&adapter->clist_lock); |
857 | 857 | ||
858 | dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", | 858 | dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", |
859 | client->name, client->dev.bus_id); | 859 | client->name, dev_name(&client->dev)); |
860 | 860 | ||
861 | if (adapter->client_register) { | 861 | if (adapter->client_register) { |
862 | if (adapter->client_register(client)) { | 862 | if (adapter->client_register(client)) { |
diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c index d82f7f727f7a..71b82434264d 100644 --- a/drivers/input/misc/apanel.c +++ b/drivers/input/misc/apanel.c | |||
@@ -57,7 +57,7 @@ static enum apanel_chip device_chip[APANEL_DEV_MAX]; | |||
57 | 57 | ||
58 | struct apanel { | 58 | struct apanel { |
59 | struct input_polled_dev *ipdev; | 59 | struct input_polled_dev *ipdev; |
60 | struct i2c_client client; | 60 | struct i2c_client *client; |
61 | unsigned short keymap[MAX_PANEL_KEYS]; | 61 | unsigned short keymap[MAX_PANEL_KEYS]; |
62 | u16 nkeys; | 62 | u16 nkeys; |
63 | u16 led_bits; | 63 | u16 led_bits; |
@@ -66,16 +66,7 @@ struct apanel { | |||
66 | }; | 66 | }; |
67 | 67 | ||
68 | 68 | ||
69 | static int apanel_probe(struct i2c_adapter *, int, int); | 69 | static int apanel_probe(struct i2c_client *, const struct i2c_device_id *); |
70 | |||
71 | /* for now, we only support one address */ | ||
72 | static unsigned short normal_i2c[] = {0, I2C_CLIENT_END}; | ||
73 | static unsigned short ignore = I2C_CLIENT_END; | ||
74 | static struct i2c_client_address_data addr_data = { | ||
75 | .normal_i2c = normal_i2c, | ||
76 | .probe = &ignore, | ||
77 | .ignore = &ignore, | ||
78 | }; | ||
79 | 70 | ||
80 | static void report_key(struct input_dev *input, unsigned keycode) | 71 | static void report_key(struct input_dev *input, unsigned keycode) |
81 | { | 72 | { |
@@ -103,12 +94,12 @@ static void apanel_poll(struct input_polled_dev *ipdev) | |||
103 | s32 data; | 94 | s32 data; |
104 | int i; | 95 | int i; |
105 | 96 | ||
106 | data = i2c_smbus_read_word_data(&ap->client, cmd); | 97 | data = i2c_smbus_read_word_data(ap->client, cmd); |
107 | if (data < 0) | 98 | if (data < 0) |
108 | return; /* ignore errors (due to ACPI??) */ | 99 | return; /* ignore errors (due to ACPI??) */ |
109 | 100 | ||
110 | /* write back to clear latch */ | 101 | /* write back to clear latch */ |
111 | i2c_smbus_write_word_data(&ap->client, cmd, 0); | 102 | i2c_smbus_write_word_data(ap->client, cmd, 0); |
112 | 103 | ||
113 | if (!data) | 104 | if (!data) |
114 | return; | 105 | return; |
@@ -124,7 +115,7 @@ static void led_update(struct work_struct *work) | |||
124 | { | 115 | { |
125 | struct apanel *ap = container_of(work, struct apanel, led_work); | 116 | struct apanel *ap = container_of(work, struct apanel, led_work); |
126 | 117 | ||
127 | i2c_smbus_write_word_data(&ap->client, 0x10, ap->led_bits); | 118 | i2c_smbus_write_word_data(ap->client, 0x10, ap->led_bits); |
128 | } | 119 | } |
129 | 120 | ||
130 | static void mail_led_set(struct led_classdev *led, | 121 | static void mail_led_set(struct led_classdev *led, |
@@ -140,7 +131,7 @@ static void mail_led_set(struct led_classdev *led, | |||
140 | schedule_work(&ap->led_work); | 131 | schedule_work(&ap->led_work); |
141 | } | 132 | } |
142 | 133 | ||
143 | static int apanel_detach_client(struct i2c_client *client) | 134 | static int apanel_remove(struct i2c_client *client) |
144 | { | 135 | { |
145 | struct apanel *ap = i2c_get_clientdata(client); | 136 | struct apanel *ap = i2c_get_clientdata(client); |
146 | 137 | ||
@@ -148,43 +139,33 @@ static int apanel_detach_client(struct i2c_client *client) | |||
148 | led_classdev_unregister(&ap->mail_led); | 139 | led_classdev_unregister(&ap->mail_led); |
149 | 140 | ||
150 | input_unregister_polled_device(ap->ipdev); | 141 | input_unregister_polled_device(ap->ipdev); |
151 | i2c_detach_client(&ap->client); | ||
152 | input_free_polled_device(ap->ipdev); | 142 | input_free_polled_device(ap->ipdev); |
153 | 143 | ||
154 | return 0; | 144 | return 0; |
155 | } | 145 | } |
156 | 146 | ||
157 | /* Function is invoked for every i2c adapter. */ | ||
158 | static int apanel_attach_adapter(struct i2c_adapter *adap) | ||
159 | { | ||
160 | dev_dbg(&adap->dev, APANEL ": attach adapter id=%d\n", adap->id); | ||
161 | |||
162 | /* Our device is connected only to i801 on laptop */ | ||
163 | if (adap->id != I2C_HW_SMBUS_I801) | ||
164 | return -ENODEV; | ||
165 | |||
166 | return i2c_probe(adap, &addr_data, apanel_probe); | ||
167 | } | ||
168 | |||
169 | static void apanel_shutdown(struct i2c_client *client) | 147 | static void apanel_shutdown(struct i2c_client *client) |
170 | { | 148 | { |
171 | apanel_detach_client(client); | 149 | apanel_remove(client); |
172 | } | 150 | } |
173 | 151 | ||
152 | static struct i2c_device_id apanel_id[] = { | ||
153 | { "fujitsu_apanel", 0 }, | ||
154 | { } | ||
155 | }; | ||
156 | MODULE_DEVICE_TABLE(i2c, apanel_id); | ||
157 | |||
174 | static struct i2c_driver apanel_driver = { | 158 | static struct i2c_driver apanel_driver = { |
175 | .driver = { | 159 | .driver = { |
176 | .name = APANEL, | 160 | .name = APANEL, |
177 | }, | 161 | }, |
178 | .attach_adapter = &apanel_attach_adapter, | 162 | .probe = &apanel_probe, |
179 | .detach_client = &apanel_detach_client, | 163 | .remove = &apanel_remove, |
180 | .shutdown = &apanel_shutdown, | 164 | .shutdown = &apanel_shutdown, |
165 | .id_table = apanel_id, | ||
181 | }; | 166 | }; |
182 | 167 | ||
183 | static struct apanel apanel = { | 168 | static struct apanel apanel = { |
184 | .client = { | ||
185 | .driver = &apanel_driver, | ||
186 | .name = APANEL, | ||
187 | }, | ||
188 | .keymap = { | 169 | .keymap = { |
189 | [0] = KEY_MAIL, | 170 | [0] = KEY_MAIL, |
190 | [1] = KEY_WWW, | 171 | [1] = KEY_WWW, |
@@ -204,7 +185,8 @@ static struct apanel apanel = { | |||
204 | }; | 185 | }; |
205 | 186 | ||
206 | /* NB: Only one panel on the i2c. */ | 187 | /* NB: Only one panel on the i2c. */ |
207 | static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | 188 | static int apanel_probe(struct i2c_client *client, |
189 | const struct i2c_device_id *id) | ||
208 | { | 190 | { |
209 | struct apanel *ap; | 191 | struct apanel *ap; |
210 | struct input_polled_dev *ipdev; | 192 | struct input_polled_dev *ipdev; |
@@ -212,9 +194,6 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | |||
212 | u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8; | 194 | u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8; |
213 | int i, err = -ENOMEM; | 195 | int i, err = -ENOMEM; |
214 | 196 | ||
215 | dev_dbg(&bus->dev, APANEL ": probe adapter %p addr %d kind %d\n", | ||
216 | bus, address, kind); | ||
217 | |||
218 | ap = &apanel; | 197 | ap = &apanel; |
219 | 198 | ||
220 | ipdev = input_allocate_polled_device(); | 199 | ipdev = input_allocate_polled_device(); |
@@ -222,18 +201,13 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | |||
222 | goto out1; | 201 | goto out1; |
223 | 202 | ||
224 | ap->ipdev = ipdev; | 203 | ap->ipdev = ipdev; |
225 | ap->client.adapter = bus; | 204 | ap->client = client; |
226 | ap->client.addr = address; | ||
227 | |||
228 | i2c_set_clientdata(&ap->client, ap); | ||
229 | 205 | ||
230 | err = i2c_attach_client(&ap->client); | 206 | i2c_set_clientdata(client, ap); |
231 | if (err) | ||
232 | goto out2; | ||
233 | 207 | ||
234 | err = i2c_smbus_write_word_data(&ap->client, cmd, 0); | 208 | err = i2c_smbus_write_word_data(client, cmd, 0); |
235 | if (err) { | 209 | if (err) { |
236 | dev_warn(&ap->client.dev, APANEL ": smbus write error %d\n", | 210 | dev_warn(&client->dev, APANEL ": smbus write error %d\n", |
237 | err); | 211 | err); |
238 | goto out3; | 212 | goto out3; |
239 | } | 213 | } |
@@ -246,7 +220,7 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | |||
246 | idev->name = APANEL_NAME " buttons"; | 220 | idev->name = APANEL_NAME " buttons"; |
247 | idev->phys = "apanel/input0"; | 221 | idev->phys = "apanel/input0"; |
248 | idev->id.bustype = BUS_HOST; | 222 | idev->id.bustype = BUS_HOST; |
249 | idev->dev.parent = &ap->client.dev; | 223 | idev->dev.parent = &client->dev; |
250 | 224 | ||
251 | set_bit(EV_KEY, idev->evbit); | 225 | set_bit(EV_KEY, idev->evbit); |
252 | 226 | ||
@@ -264,7 +238,7 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | |||
264 | 238 | ||
265 | INIT_WORK(&ap->led_work, led_update); | 239 | INIT_WORK(&ap->led_work, led_update); |
266 | if (device_chip[APANEL_DEV_LED] != CHIP_NONE) { | 240 | if (device_chip[APANEL_DEV_LED] != CHIP_NONE) { |
267 | err = led_classdev_register(&ap->client.dev, &ap->mail_led); | 241 | err = led_classdev_register(&client->dev, &ap->mail_led); |
268 | if (err) | 242 | if (err) |
269 | goto out4; | 243 | goto out4; |
270 | } | 244 | } |
@@ -273,8 +247,6 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | |||
273 | out4: | 247 | out4: |
274 | input_unregister_polled_device(ipdev); | 248 | input_unregister_polled_device(ipdev); |
275 | out3: | 249 | out3: |
276 | i2c_detach_client(&ap->client); | ||
277 | out2: | ||
278 | input_free_polled_device(ipdev); | 250 | input_free_polled_device(ipdev); |
279 | out1: | 251 | out1: |
280 | return err; | 252 | return err; |
@@ -301,6 +273,7 @@ static int __init apanel_init(void) | |||
301 | void __iomem *bios; | 273 | void __iomem *bios; |
302 | const void __iomem *p; | 274 | const void __iomem *p; |
303 | u8 devno; | 275 | u8 devno; |
276 | unsigned char i2c_addr; | ||
304 | int found = 0; | 277 | int found = 0; |
305 | 278 | ||
306 | bios = ioremap(0xF0000, 0x10000); /* Can't fail */ | 279 | bios = ioremap(0xF0000, 0x10000); /* Can't fail */ |
@@ -313,7 +286,7 @@ static int __init apanel_init(void) | |||
313 | 286 | ||
314 | /* just use the first address */ | 287 | /* just use the first address */ |
315 | p += 8; | 288 | p += 8; |
316 | normal_i2c[0] = readb(p+3) >> 1; | 289 | i2c_addr = readb(p + 3) >> 1; |
317 | 290 | ||
318 | for ( ; (devno = readb(p)) & 0x7f; p += 4) { | 291 | for ( ; (devno = readb(p)) & 0x7f; p += 4) { |
319 | unsigned char method, slave, chip; | 292 | unsigned char method, slave, chip; |
@@ -322,7 +295,7 @@ static int __init apanel_init(void) | |||
322 | chip = readb(p + 2); | 295 | chip = readb(p + 2); |
323 | slave = readb(p + 3) >> 1; | 296 | slave = readb(p + 3) >> 1; |
324 | 297 | ||
325 | if (slave != normal_i2c[0]) { | 298 | if (slave != i2c_addr) { |
326 | pr_notice(APANEL ": only one SMBus slave " | 299 | pr_notice(APANEL ": only one SMBus slave " |
327 | "address supported, skiping device...\n"); | 300 | "address supported, skiping device...\n"); |
328 | continue; | 301 | continue; |
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 34a39d2e4703..46fd573a4f15 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -569,7 +569,6 @@ static int cafe_smbus_setup(struct cafe_camera *cam) | |||
569 | 569 | ||
570 | cafe_smbus_enable_irq(cam); | 570 | cafe_smbus_enable_irq(cam); |
571 | adap->id = I2C_HW_SMBUS_CAFE; | 571 | adap->id = I2C_HW_SMBUS_CAFE; |
572 | adap->class = I2C_CLASS_CAM_DIGITAL; | ||
573 | adap->owner = THIS_MODULE; | 572 | adap->owner = THIS_MODULE; |
574 | adap->client_register = cafe_smbus_attach; | 573 | adap->client_register = cafe_smbus_attach; |
575 | adap->client_unregister = cafe_smbus_detach; | 574 | adap->client_unregister = cafe_smbus_detach; |
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index ca26b0c50cf2..05c14a29375a 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c | |||
@@ -1347,7 +1347,6 @@ static struct i2c_driver ov7670_driver = { | |||
1347 | .name = "ov7670", | 1347 | .name = "ov7670", |
1348 | }, | 1348 | }, |
1349 | .id = I2C_DRIVERID_OV7670, | 1349 | .id = I2C_DRIVERID_OV7670, |
1350 | .class = I2C_CLASS_CAM_DIGITAL, | ||
1351 | .attach_adapter = ov7670_attach, | 1350 | .attach_adapter = ov7670_attach, |
1352 | .detach_client = ov7670_detach, | 1351 | .detach_client = ov7670_detach, |
1353 | .command = ov7670_command, | 1352 | .command = ov7670_command, |
diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index 2c4acbf5a4fe..c841f4e4fbe4 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c | |||
@@ -405,7 +405,6 @@ static struct i2c_driver driver = { | |||
405 | .name = "ovcamchip", | 405 | .name = "ovcamchip", |
406 | }, | 406 | }, |
407 | .id = I2C_DRIVERID_OVCAMCHIP, | 407 | .id = I2C_DRIVERID_OVCAMCHIP, |
408 | .class = I2C_CLASS_CAM_DIGITAL, | ||
409 | .attach_adapter = ovcamchip_attach, | 408 | .attach_adapter = ovcamchip_attach, |
410 | .detach_client = ovcamchip_detach, | 409 | .detach_client = ovcamchip_detach, |
411 | .command = ovcamchip_command, | 410 | .command = ovcamchip_command, |
diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c index a3997b7d4366..105a832531f2 100644 --- a/drivers/media/video/w9968cf.c +++ b/drivers/media/video/w9968cf.c | |||
@@ -1553,7 +1553,6 @@ static int w9968cf_i2c_init(struct w9968cf_device* cam) | |||
1553 | 1553 | ||
1554 | static struct i2c_adapter adap = { | 1554 | static struct i2c_adapter adap = { |
1555 | .id = I2C_HW_SMBUS_W9968CF, | 1555 | .id = I2C_HW_SMBUS_W9968CF, |
1556 | .class = I2C_CLASS_CAM_DIGITAL, | ||
1557 | .owner = THIS_MODULE, | 1556 | .owner = THIS_MODULE, |
1558 | .client_register = w9968cf_i2c_attach_inform, | 1557 | .client_register = w9968cf_i2c_attach_inform, |
1559 | .client_unregister = w9968cf_i2c_detach_inform, | 1558 | .client_unregister = w9968cf_i2c_detach_inform, |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 33a5992d4936..20873d402467 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -393,11 +393,7 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) | |||
393 | #define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ | 393 | #define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ |
394 | #define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ | 394 | #define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ |
395 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ | 395 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ |
396 | #define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */ | ||
397 | #define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */ | ||
398 | #define I2C_CLASS_SOUND (1<<6) /* sound devices */ | ||
399 | #define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ | 396 | #define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ |
400 | #define I2C_CLASS_ALL (UINT_MAX) /* all of the above */ | ||
401 | 397 | ||
402 | /* i2c_client_address_data is the struct for holding default client | 398 | /* i2c_client_address_data is the struct for holding default client |
403 | * addresses for a driver and for the parameters supplied on the | 399 | * addresses for a driver and for the parameters supplied on the |