aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/i2c-core.c4
-rw-r--r--include/linux/i2c.h100
-rw-r--r--include/media/v4l2-i2c-drv-legacy.h2
3 files changed, 46 insertions, 60 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index b5e13e405e72..7788e1730063 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -978,7 +978,7 @@ static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind,
978} 978}
979 979
980int i2c_probe(struct i2c_adapter *adapter, 980int i2c_probe(struct i2c_adapter *adapter,
981 struct i2c_client_address_data *address_data, 981 const struct i2c_client_address_data *address_data,
982 int (*found_proc) (struct i2c_adapter *, int, int)) 982 int (*found_proc) (struct i2c_adapter *, int, int))
983{ 983{
984 int i, err; 984 int i, err;
@@ -987,7 +987,7 @@ int i2c_probe(struct i2c_adapter *adapter,
987 /* Force entries are done first, and are not affected by ignore 987 /* Force entries are done first, and are not affected by ignore
988 entries */ 988 entries */
989 if (address_data->forces) { 989 if (address_data->forces) {
990 unsigned short **forces = address_data->forces; 990 const unsigned short * const *forces = address_data->forces;
991 int kind; 991 int kind;
992 992
993 for (kind = 0; forces[kind]; kind++) { 993 for (kind = 0; forces[kind]; kind++) {
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index a100c9f8eb7c..37c14b08d61a 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -357,10 +357,10 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
357 * command line 357 * command line
358 */ 358 */
359struct i2c_client_address_data { 359struct i2c_client_address_data {
360 unsigned short *normal_i2c; 360 const unsigned short *normal_i2c;
361 unsigned short *probe; 361 const unsigned short *probe;
362 unsigned short *ignore; 362 const unsigned short *ignore;
363 unsigned short **forces; 363 const unsigned short * const *forces;
364}; 364};
365 365
366/* Internal numbers to terminate lists */ 366/* Internal numbers to terminate lists */
@@ -405,7 +405,7 @@ extern void i2c_clients_command(struct i2c_adapter *adap,
405 * specific address (unless a 'force' matched); 405 * specific address (unless a 'force' matched);
406 */ 406 */
407extern int i2c_probe(struct i2c_adapter *adapter, 407extern int i2c_probe(struct i2c_adapter *adapter,
408 struct i2c_client_address_data *address_data, 408 const struct i2c_client_address_data *address_data,
409 int (*found_proc) (struct i2c_adapter *, int, int)); 409 int (*found_proc) (struct i2c_adapter *, int, int));
410 410
411extern struct i2c_adapter* i2c_get_adapter(int id); 411extern struct i2c_adapter* i2c_get_adapter(int id);
@@ -598,104 +598,93 @@ I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \
598 "additionally"); \ 598 "additionally"); \
599I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \ 599I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \
600 "scan"); \ 600 "scan"); \
601static struct i2c_client_address_data addr_data = { \ 601const static struct i2c_client_address_data addr_data = { \
602 .normal_i2c = normal_i2c, \ 602 .normal_i2c = normal_i2c, \
603 .probe = probe, \ 603 .probe = probe, \
604 .ignore = ignore, \ 604 .ignore = ignore, \
605 .forces = forces, \ 605 .forces = forces, \
606} 606}
607 607
608#define I2C_CLIENT_FORCE_TEXT \
609 "List of adapter,address pairs to boldly assume to be present"
610
608/* These are the ones you want to use in your own drivers. Pick the one 611/* These are the ones you want to use in your own drivers. Pick the one
609 which matches the number of devices the driver differenciates between. */ 612 which matches the number of devices the driver differenciates between. */
610#define I2C_CLIENT_INSMOD \ 613#define I2C_CLIENT_INSMOD \
611 I2C_CLIENT_MODULE_PARM(force, \ 614I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
612 "List of adapter,address pairs to boldly assume " \ 615static const unsigned short * const forces[] = { force, NULL }; \
613 "to be present"); \
614 static unsigned short *forces[] = { \
615 force, \
616 NULL \
617 }; \
618I2C_CLIENT_INSMOD_COMMON 616I2C_CLIENT_INSMOD_COMMON
619 617
620#define I2C_CLIENT_INSMOD_1(chip1) \ 618#define I2C_CLIENT_INSMOD_1(chip1) \
621enum chips { any_chip, chip1 }; \ 619enum chips { any_chip, chip1 }; \
622I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 620I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
623 "boldly assume to be present"); \
624I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 621I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
625static unsigned short *forces[] = { force, force_##chip1, NULL }; \ 622static const unsigned short * const forces[] = { force, \
623 force_##chip1, NULL }; \
626I2C_CLIENT_INSMOD_COMMON 624I2C_CLIENT_INSMOD_COMMON
627 625
628#define I2C_CLIENT_INSMOD_2(chip1, chip2) \ 626#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
629enum chips { any_chip, chip1, chip2 }; \ 627enum chips { any_chip, chip1, chip2 }; \
630I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 628I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
631 "boldly assume to be present"); \
632I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 629I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
633I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 630I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
634static unsigned short *forces[] = { force, force_##chip1, \ 631static const unsigned short * const forces[] = { force, \
635 force_##chip2, NULL }; \ 632 force_##chip1, force_##chip2, NULL }; \
636I2C_CLIENT_INSMOD_COMMON 633I2C_CLIENT_INSMOD_COMMON
637 634
638#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ 635#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
639enum chips { any_chip, chip1, chip2, chip3 }; \ 636enum chips { any_chip, chip1, chip2, chip3 }; \
640I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 637I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
641 "boldly assume to be present"); \
642I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 638I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
643I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 639I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
644I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 640I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
645static unsigned short *forces[] = { force, force_##chip1, \ 641static const unsigned short * const forces[] = { force, \
646 force_##chip2, force_##chip3, \ 642 force_##chip1, force_##chip2, force_##chip3, NULL }; \
647 NULL }; \
648I2C_CLIENT_INSMOD_COMMON 643I2C_CLIENT_INSMOD_COMMON
649 644
650#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \ 645#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
651enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ 646enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
652I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 647I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
653 "boldly assume to be present"); \
654I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 648I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
655I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 649I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
656I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 650I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
657I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ 651I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
658static unsigned short *forces[] = { force, force_##chip1, \ 652static const unsigned short * const forces[] = { force, \
659 force_##chip2, force_##chip3, \ 653 force_##chip1, force_##chip2, force_##chip3, \
660 force_##chip4, NULL}; \ 654 force_##chip4, NULL}; \
661I2C_CLIENT_INSMOD_COMMON 655I2C_CLIENT_INSMOD_COMMON
662 656
663#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \ 657#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
664enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ 658enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
665I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 659I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
666 "boldly assume to be present"); \
667I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 660I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
668I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 661I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
669I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 662I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
670I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ 663I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
671I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ 664I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
672static unsigned short *forces[] = { force, force_##chip1, \ 665static const unsigned short * const forces[] = { force, \
673 force_##chip2, force_##chip3, \ 666 force_##chip1, force_##chip2, force_##chip3, \
674 force_##chip4, force_##chip5, \ 667 force_##chip4, force_##chip5, NULL }; \
675 NULL }; \
676I2C_CLIENT_INSMOD_COMMON 668I2C_CLIENT_INSMOD_COMMON
677 669
678#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \ 670#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
679enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ 671enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
680I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 672I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
681 "boldly assume to be present"); \
682I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 673I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
683I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 674I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
684I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 675I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
685I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ 676I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
686I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ 677I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
687I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ 678I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
688static unsigned short *forces[] = { force, force_##chip1, \ 679static const unsigned short * const forces[] = { force, \
689 force_##chip2, force_##chip3, \ 680 force_##chip1, force_##chip2, force_##chip3, \
690 force_##chip4, force_##chip5, \ 681 force_##chip4, force_##chip5, force_##chip6, NULL }; \
691 force_##chip6, NULL }; \
692I2C_CLIENT_INSMOD_COMMON 682I2C_CLIENT_INSMOD_COMMON
693 683
694#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \ 684#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
695enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ 685enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
696 chip7 }; \ 686 chip7 }; \
697I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 687I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
698 "boldly assume to be present"); \
699I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 688I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
700I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 689I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
701I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 690I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
@@ -703,18 +692,16 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
703I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ 692I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
704I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ 693I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
705I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ 694I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
706static unsigned short *forces[] = { force, force_##chip1, \ 695static const unsigned short * const forces[] = { force, \
707 force_##chip2, force_##chip3, \ 696 force_##chip1, force_##chip2, force_##chip3, \
708 force_##chip4, force_##chip5, \ 697 force_##chip4, force_##chip5, force_##chip6, \
709 force_##chip6, force_##chip7, \ 698 force_##chip7, NULL }; \
710 NULL }; \
711I2C_CLIENT_INSMOD_COMMON 699I2C_CLIENT_INSMOD_COMMON
712 700
713#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \ 701#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
714enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ 702enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
715 chip7, chip8 }; \ 703 chip7, chip8 }; \
716I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 704I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
717 "boldly assume to be present"); \
718I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 705I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
719I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 706I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
720I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 707I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
@@ -723,11 +710,10 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
723I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ 710I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
724I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ 711I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
725I2C_CLIENT_MODULE_PARM_FORCE(chip8); \ 712I2C_CLIENT_MODULE_PARM_FORCE(chip8); \
726static unsigned short *forces[] = { force, force_##chip1, \ 713static const unsigned short * const forces[] = { force, \
727 force_##chip2, force_##chip3, \ 714 force_##chip1, force_##chip2, force_##chip3, \
728 force_##chip4, force_##chip5, \ 715 force_##chip4, force_##chip5, force_##chip6, \
729 force_##chip6, force_##chip7, \ 716 force_##chip7, force_##chip8, NULL }; \
730 force_##chip8, NULL }; \
731I2C_CLIENT_INSMOD_COMMON 717I2C_CLIENT_INSMOD_COMMON
732#endif /* __KERNEL__ */ 718#endif /* __KERNEL__ */
733#endif /* _LINUX_I2C_H */ 719#endif /* _LINUX_I2C_H */
diff --git a/include/media/v4l2-i2c-drv-legacy.h b/include/media/v4l2-i2c-drv-legacy.h
index 241854229d6f..e7645578fc22 100644
--- a/include/media/v4l2-i2c-drv-legacy.h
+++ b/include/media/v4l2-i2c-drv-legacy.h
@@ -34,7 +34,7 @@ struct v4l2_i2c_driver_data {
34}; 34};
35 35
36static struct v4l2_i2c_driver_data v4l2_i2c_data; 36static struct v4l2_i2c_driver_data v4l2_i2c_data;
37static struct i2c_client_address_data addr_data; 37static const struct i2c_client_address_data addr_data;
38static struct i2c_driver v4l2_i2c_driver_legacy; 38static struct i2c_driver v4l2_i2c_driver_legacy;
39static char v4l2_i2c_drv_name_legacy[32]; 39static char v4l2_i2c_drv_name_legacy[32];
40 40