@@ -66,6 +66,7 @@ struct mxs_gpio_port {
66
66
int irq ;
67
67
struct irq_domain * domain ;
68
68
struct gpio_chip gc ;
69
+ struct device * dev ;
69
70
enum mxs_gpio_id devid ;
70
71
u32 both_edges ;
71
72
};
@@ -209,9 +210,10 @@ static int mxs_gpio_init_gc(struct mxs_gpio_port *port, int irq_base)
209
210
{
210
211
struct irq_chip_generic * gc ;
211
212
struct irq_chip_type * ct ;
213
+ int rv ;
212
214
213
- gc = irq_alloc_generic_chip ( "gpio-mxs" , 2 , irq_base ,
214
- port -> base , handle_level_irq );
215
+ gc = devm_irq_alloc_generic_chip ( port -> dev , "gpio-mxs" , 2 , irq_base ,
216
+ port -> base , handle_level_irq );
215
217
if (!gc )
216
218
return - ENOMEM ;
217
219
@@ -242,10 +244,11 @@ static int mxs_gpio_init_gc(struct mxs_gpio_port *port, int irq_base)
242
244
ct -> regs .disable = PINCTRL_IRQEN (port ) + MXS_CLR ;
243
245
ct -> handler = handle_level_irq ;
244
246
245
- irq_setup_generic_chip (gc , IRQ_MSK (32 ), IRQ_GC_INIT_NESTED_LOCK ,
246
- IRQ_NOREQUEST , 0 );
247
+ rv = devm_irq_setup_generic_chip (port -> dev , gc , IRQ_MSK (32 ),
248
+ IRQ_GC_INIT_NESTED_LOCK ,
249
+ IRQ_NOREQUEST , 0 );
247
250
248
- return 0 ;
251
+ return rv ;
249
252
}
250
253
251
254
static int mxs_gpio_to_irq (struct gpio_chip * gc , unsigned offset )
@@ -304,6 +307,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
304
307
if (port -> id < 0 )
305
308
return port -> id ;
306
309
port -> devid = (enum mxs_gpio_id ) of_id -> data ;
310
+ port -> dev = & pdev -> dev ;
307
311
port -> irq = platform_get_irq (pdev , 0 );
308
312
if (port -> irq < 0 )
309
313
return port -> irq ;
0 commit comments