aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/cpm1.c
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2010-06-08 09:48:16 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-07-05 18:14:30 -0400
commita19e3da5bc5fc6c10ab73f310bea80f3845b4531 (patch)
tree49b6e952f48e56d9701f92e0c24044a14b676a34 /arch/powerpc/sysdev/cpm1.c
parentcedb1881ba32f7e9cd49250bd79debccbe52b094 (diff)
of/gpio: Kill of_gpio_chip and add members directly to gpio_chip
The OF gpio infrastructure is great for describing GPIO connections within the device tree. However, using a GPIO binding still requires changes to the gpio controller just to add an of_gpio structure. In most cases, the gpio controller doesn't actually need any special support and the simple OF gpio mapping function is more than sufficient. Additional, the current scheme of using of_gpio_chip requires a convoluted scheme to maintain 1:1 mappings between of_gpio_chip and gpio_chip instances. If the struct of_gpio_chip data members were moved into struct gpio_chip, then it would simplify the processing of OF gpio bindings, and it would make it trivial to use device tree OF connections on existing gpiolib controller drivers. This patch eliminates the of_gpio_chip structure and moves the relevant fields into struct gpio_chip (conditional on CONFIG_OF_GPIO). This move simplifies the existing code and prepares for adding automatic device tree support to existing drivers. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: David Brownell <dbrownell@users.sourceforge.net> Cc: Bill Gatliff <bgat@billgatliff.com> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'arch/powerpc/sysdev/cpm1.c')
-rw-r--r--arch/powerpc/sysdev/cpm1.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index 8d103ca6d6ab..d5cf7d4ccf81 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -621,7 +621,6 @@ int cpm1_gpiochip_add16(struct device_node *np)
621{ 621{
622 struct cpm1_gpio16_chip *cpm1_gc; 622 struct cpm1_gpio16_chip *cpm1_gc;
623 struct of_mm_gpio_chip *mm_gc; 623 struct of_mm_gpio_chip *mm_gc;
624 struct of_gpio_chip *of_gc;
625 struct gpio_chip *gc; 624 struct gpio_chip *gc;
626 625
627 cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL); 626 cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL);
@@ -631,11 +630,10 @@ int cpm1_gpiochip_add16(struct device_node *np)
631 spin_lock_init(&cpm1_gc->lock); 630 spin_lock_init(&cpm1_gc->lock);
632 631
633 mm_gc = &cpm1_gc->mm_gc; 632 mm_gc = &cpm1_gc->mm_gc;
634 of_gc = &mm_gc->of_gc; 633 gc = &mm_gc->gc;
635 gc = &of_gc->gc;
636 634
637 mm_gc->save_regs = cpm1_gpio16_save_regs; 635 mm_gc->save_regs = cpm1_gpio16_save_regs;
638 of_gc->gpio_cells = 2; 636 gc->of_gpio_n_cells = 2;
639 gc->ngpio = 16; 637 gc->ngpio = 16;
640 gc->direction_input = cpm1_gpio16_dir_in; 638 gc->direction_input = cpm1_gpio16_dir_in;
641 gc->direction_output = cpm1_gpio16_dir_out; 639 gc->direction_output = cpm1_gpio16_dir_out;
@@ -745,7 +743,6 @@ int cpm1_gpiochip_add32(struct device_node *np)
745{ 743{
746 struct cpm1_gpio32_chip *cpm1_gc; 744 struct cpm1_gpio32_chip *cpm1_gc;
747 struct of_mm_gpio_chip *mm_gc; 745 struct of_mm_gpio_chip *mm_gc;
748 struct of_gpio_chip *of_gc;
749 struct gpio_chip *gc; 746 struct gpio_chip *gc;
750 747
751 cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL); 748 cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL);
@@ -755,11 +752,10 @@ int cpm1_gpiochip_add32(struct device_node *np)
755 spin_lock_init(&cpm1_gc->lock); 752 spin_lock_init(&cpm1_gc->lock);
756 753
757 mm_gc = &cpm1_gc->mm_gc; 754 mm_gc = &cpm1_gc->mm_gc;
758 of_gc = &mm_gc->of_gc; 755 gc = &mm_gc->gc;
759 gc = &of_gc->gc;
760 756
761 mm_gc->save_regs = cpm1_gpio32_save_regs; 757 mm_gc->save_regs = cpm1_gpio32_save_regs;
762 of_gc->gpio_cells = 2; 758 gc->of_gpio_n_cells = 2;
763 gc->ngpio = 32; 759 gc->ngpio = 32;
764 gc->direction_input = cpm1_gpio32_dir_in; 760 gc->direction_input = cpm1_gpio32_dir_in;
765 gc->direction_output = cpm1_gpio32_dir_out; 761 gc->direction_output = cpm1_gpio32_dir_out;