diff options
author | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-01-27 12:14:46 -0500 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2008-01-27 12:14:46 -0500 |
commit | bfb6df24facfde7ec6191edbba798777efb3c375 (patch) | |
tree | 474d907bad7e11e0595183cfa39197e03d85e6d5 /include/linux | |
parent | 6408a8338c63e2beb50e8128814cbc1170390d3a (diff) |
i2c: Constify client address data
This patch allows much of the I2C client address data to move from initdata
into text.
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/i2c.h | 100 |
1 files changed, 43 insertions, 57 deletions
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 | */ |
359 | struct i2c_client_address_data { | 359 | struct 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 | */ |
407 | extern int i2c_probe(struct i2c_adapter *adapter, | 407 | extern 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 | ||
411 | extern struct i2c_adapter* i2c_get_adapter(int id); | 411 | extern 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"); \ |
599 | I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \ | 599 | I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \ |
600 | "scan"); \ | 600 | "scan"); \ |
601 | static struct i2c_client_address_data addr_data = { \ | 601 | const 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, \ | 614 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ |
612 | "List of adapter,address pairs to boldly assume " \ | 615 | static const unsigned short * const forces[] = { force, NULL }; \ |
613 | "to be present"); \ | ||
614 | static unsigned short *forces[] = { \ | ||
615 | force, \ | ||
616 | NULL \ | ||
617 | }; \ | ||
618 | I2C_CLIENT_INSMOD_COMMON | 616 | I2C_CLIENT_INSMOD_COMMON |
619 | 617 | ||
620 | #define I2C_CLIENT_INSMOD_1(chip1) \ | 618 | #define I2C_CLIENT_INSMOD_1(chip1) \ |
621 | enum chips { any_chip, chip1 }; \ | 619 | enum chips { any_chip, chip1 }; \ |
622 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | 620 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ |
623 | "boldly assume to be present"); \ | ||
624 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | 621 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ |
625 | static unsigned short *forces[] = { force, force_##chip1, NULL }; \ | 622 | static const unsigned short * const forces[] = { force, \ |
623 | force_##chip1, NULL }; \ | ||
626 | I2C_CLIENT_INSMOD_COMMON | 624 | I2C_CLIENT_INSMOD_COMMON |
627 | 625 | ||
628 | #define I2C_CLIENT_INSMOD_2(chip1, chip2) \ | 626 | #define I2C_CLIENT_INSMOD_2(chip1, chip2) \ |
629 | enum chips { any_chip, chip1, chip2 }; \ | 627 | enum chips { any_chip, chip1, chip2 }; \ |
630 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | 628 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ |
631 | "boldly assume to be present"); \ | ||
632 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | 629 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ |
633 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | 630 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ |
634 | static unsigned short *forces[] = { force, force_##chip1, \ | 631 | static const unsigned short * const forces[] = { force, \ |
635 | force_##chip2, NULL }; \ | 632 | force_##chip1, force_##chip2, NULL }; \ |
636 | I2C_CLIENT_INSMOD_COMMON | 633 | I2C_CLIENT_INSMOD_COMMON |
637 | 634 | ||
638 | #define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ | 635 | #define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ |
639 | enum chips { any_chip, chip1, chip2, chip3 }; \ | 636 | enum chips { any_chip, chip1, chip2, chip3 }; \ |
640 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | 637 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ |
641 | "boldly assume to be present"); \ | ||
642 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | 638 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ |
643 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | 639 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ |
644 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | 640 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ |
645 | static unsigned short *forces[] = { force, force_##chip1, \ | 641 | static const unsigned short * const forces[] = { force, \ |
646 | force_##chip2, force_##chip3, \ | 642 | force_##chip1, force_##chip2, force_##chip3, NULL }; \ |
647 | NULL }; \ | ||
648 | I2C_CLIENT_INSMOD_COMMON | 643 | I2C_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) \ |
651 | enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ | 646 | enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ |
652 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | 647 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ |
653 | "boldly assume to be present"); \ | ||
654 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | 648 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ |
655 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | 649 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ |
656 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | 650 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ |
657 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | 651 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ |
658 | static unsigned short *forces[] = { force, force_##chip1, \ | 652 | static 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}; \ |
661 | I2C_CLIENT_INSMOD_COMMON | 655 | I2C_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) \ |
664 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ | 658 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ |
665 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | 659 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ |
666 | "boldly assume to be present"); \ | ||
667 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | 660 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ |
668 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | 661 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ |
669 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | 662 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ |
670 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | 663 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ |
671 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | 664 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ |
672 | static unsigned short *forces[] = { force, force_##chip1, \ | 665 | static 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 }; \ | ||
676 | I2C_CLIENT_INSMOD_COMMON | 668 | I2C_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) \ |
679 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ | 671 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ |
680 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | 672 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ |
681 | "boldly assume to be present"); \ | ||
682 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | 673 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ |
683 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | 674 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ |
684 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | 675 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ |
685 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | 676 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ |
686 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | 677 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ |
687 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | 678 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ |
688 | static unsigned short *forces[] = { force, force_##chip1, \ | 679 | static 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 }; \ | ||
692 | I2C_CLIENT_INSMOD_COMMON | 682 | I2C_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) \ |
695 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | 685 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ |
696 | chip7 }; \ | 686 | chip7 }; \ |
697 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | 687 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ |
698 | "boldly assume to be present"); \ | ||
699 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | 688 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ |
700 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | 689 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ |
701 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | 690 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ |
@@ -703,18 +692,16 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | |||
703 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | 692 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ |
704 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | 693 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ |
705 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ | 694 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ |
706 | static unsigned short *forces[] = { force, force_##chip1, \ | 695 | static 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 }; \ | ||
711 | I2C_CLIENT_INSMOD_COMMON | 699 | I2C_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) \ |
714 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | 702 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ |
715 | chip7, chip8 }; \ | 703 | chip7, chip8 }; \ |
716 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | 704 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ |
717 | "boldly assume to be present"); \ | ||
718 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | 705 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ |
719 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | 706 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ |
720 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | 707 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ |
@@ -723,11 +710,10 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | |||
723 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | 710 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ |
724 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ | 711 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ |
725 | I2C_CLIENT_MODULE_PARM_FORCE(chip8); \ | 712 | I2C_CLIENT_MODULE_PARM_FORCE(chip8); \ |
726 | static unsigned short *forces[] = { force, force_##chip1, \ | 713 | static 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 }; \ | ||
731 | I2C_CLIENT_INSMOD_COMMON | 717 | I2C_CLIENT_INSMOD_COMMON |
732 | #endif /* __KERNEL__ */ | 718 | #endif /* __KERNEL__ */ |
733 | #endif /* _LINUX_I2C_H */ | 719 | #endif /* _LINUX_I2C_H */ |