@@ -50,7 +50,6 @@ struct brcmstb_gpio_priv {
50
50
struct irq_domain * irq_domain ;
51
51
struct irq_chip irq_chip ;
52
52
int parent_irq ;
53
- int gpio_base ;
54
53
int num_gpios ;
55
54
int parent_wake_irq ;
56
55
};
@@ -92,7 +91,7 @@ brcmstb_gpio_get_active_irqs(struct brcmstb_gpio_bank *bank)
92
91
static int brcmstb_gpio_hwirq_to_offset (irq_hw_number_t hwirq ,
93
92
struct brcmstb_gpio_bank * bank )
94
93
{
95
- return hwirq - ( bank -> gc .base - bank -> parent_priv -> gpio_base ) ;
94
+ return hwirq - bank -> gc .offset ;
96
95
}
97
96
98
97
static void brcmstb_gpio_set_imask (struct brcmstb_gpio_bank * bank ,
@@ -118,7 +117,7 @@ static int brcmstb_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
118
117
{
119
118
struct brcmstb_gpio_priv * priv = brcmstb_gpio_gc_to_priv (gc );
120
119
/* gc_offset is relative to this gpio_chip; want real offset */
121
- int hwirq = offset + ( gc -> base - priv -> gpio_base ) ;
120
+ int hwirq = offset + gc -> offset ;
122
121
123
122
if (hwirq >= priv -> num_gpios )
124
123
return - ENXIO ;
@@ -263,7 +262,7 @@ static void brcmstb_gpio_irq_bank_handler(struct brcmstb_gpio_bank *bank)
263
262
{
264
263
struct brcmstb_gpio_priv * priv = bank -> parent_priv ;
265
264
struct irq_domain * domain = priv -> irq_domain ;
266
- int hwbase = bank -> gc .base - priv -> gpio_base ;
265
+ int hwbase = bank -> gc .offset ;
267
266
unsigned long status ;
268
267
269
268
while ((status = brcmstb_gpio_get_active_irqs (bank ))) {
@@ -412,7 +411,7 @@ static int brcmstb_gpio_of_xlate(struct gpio_chip *gc,
412
411
if (WARN_ON (gpiospec -> args_count < gc -> of_gpio_n_cells ))
413
412
return - EINVAL ;
414
413
415
- offset = gpiospec -> args [0 ] - ( gc -> base - priv -> gpio_base ) ;
414
+ offset = gpiospec -> args [0 ] - bank -> gc . offset ;
416
415
if (offset >= gc -> ngpio || offset < 0 )
417
416
return - EINVAL ;
418
417
@@ -596,8 +595,8 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
596
595
const __be32 * p ;
597
596
u32 bank_width ;
598
597
int num_banks = 0 ;
598
+ int num_gpios = 0 ;
599
599
int err ;
600
- static int gpio_base ;
601
600
unsigned long flags = 0 ;
602
601
bool need_wakeup_event = false;
603
602
@@ -611,7 +610,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
611
610
if (IS_ERR (reg_base ))
612
611
return PTR_ERR (reg_base );
613
612
614
- priv -> gpio_base = gpio_base ;
615
613
priv -> reg_base = reg_base ;
616
614
priv -> pdev = pdev ;
617
615
@@ -651,7 +649,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
651
649
dev_dbg (dev , "Width 0 found: Empty bank @ %d\n" ,
652
650
num_banks );
653
651
num_banks ++ ;
654
- gpio_base += MAX_GPIO_PER_BANK ;
652
+ num_gpios += MAX_GPIO_PER_BANK ;
655
653
continue ;
656
654
}
657
655
@@ -691,7 +689,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
691
689
err = - ENOMEM ;
692
690
goto fail ;
693
691
}
694
- gc -> base = gpio_base ;
695
692
gc -> of_gpio_n_cells = 2 ;
696
693
gc -> of_xlate = brcmstb_gpio_of_xlate ;
697
694
/* not all ngpio lines are valid, will use bank width later */
@@ -713,7 +710,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
713
710
bank -> id );
714
711
goto fail ;
715
712
}
716
- gpio_base += gc -> ngpio ;
713
+ num_gpios += gc -> ngpio ;
717
714
718
715
dev_dbg (dev , "bank=%d, base=%d, ngpio=%d, width=%d\n" , bank -> id ,
719
716
gc -> base , gc -> ngpio , bank -> width );
@@ -724,7 +721,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
724
721
num_banks ++ ;
725
722
}
726
723
727
- priv -> num_gpios = gpio_base - priv -> gpio_base ;
724
+ priv -> num_gpios = num_gpios ;
728
725
if (priv -> parent_irq > 0 ) {
729
726
err = brcmstb_gpio_irq_setup (pdev , priv );
730
727
if (err )
0 commit comments