@@ -1071,7 +1071,7 @@ void gpiochip_remove(struct gpio_chip *gc)
1071
1071
1072
1072
spin_lock_irqsave (& gpio_lock , flags );
1073
1073
for (i = 0 ; i < gdev -> ngpio ; i ++ ) {
1074
- if (gpiochip_is_requested ( gc , i ))
1074
+ if (test_bit ( FLAG_REQUESTED , & gdev -> descs [ i ]. flags ))
1075
1075
break ;
1076
1076
}
1077
1077
spin_unlock_irqrestore (& gpio_lock , flags );
@@ -2359,33 +2359,6 @@ void gpiod_free(struct gpio_desc *desc)
2359
2359
gpio_device_put (desc -> gdev );
2360
2360
}
2361
2361
2362
- /**
2363
- * gpiochip_is_requested - return string iff signal was requested
2364
- * @gc: controller managing the signal
2365
- * @offset: of signal within controller's 0..(ngpio - 1) range
2366
- *
2367
- * Returns NULL if the GPIO is not currently requested, else a string.
2368
- * The string returned is the label passed to gpio_request(); if none has been
2369
- * passed it is a meaningless, non-NULL constant.
2370
- *
2371
- * This function is for use by GPIO controller drivers. The label can
2372
- * help with diagnostics, and knowing that the signal is used as a GPIO
2373
- * can help avoid accidentally multiplexing it to another controller.
2374
- */
2375
- const char * gpiochip_is_requested (struct gpio_chip * gc , unsigned int offset )
2376
- {
2377
- struct gpio_desc * desc ;
2378
-
2379
- desc = gpiochip_get_desc (gc , offset );
2380
- if (IS_ERR (desc ))
2381
- return NULL ;
2382
-
2383
- if (test_bit (FLAG_REQUESTED , & desc -> flags ) == 0 )
2384
- return NULL ;
2385
- return desc -> label ;
2386
- }
2387
- EXPORT_SYMBOL_GPL (gpiochip_is_requested );
2388
-
2389
2362
/**
2390
2363
* gpiochip_dup_line_label - Get a copy of the consumer label.
2391
2364
* @gc: GPIO chip controlling this line.
@@ -2400,18 +2373,23 @@ EXPORT_SYMBOL_GPL(gpiochip_is_requested);
2400
2373
*/
2401
2374
char * gpiochip_dup_line_label (struct gpio_chip * gc , unsigned int offset )
2402
2375
{
2403
- const char * label ;
2404
- char * copy ;
2376
+ struct gpio_desc * desc ;
2377
+ char * label ;
2405
2378
2406
- label = gpiochip_is_requested (gc , offset );
2407
- if (! label )
2379
+ desc = gpiochip_get_desc (gc , offset );
2380
+ if (IS_ERR ( desc ) )
2408
2381
return NULL ;
2409
2382
2410
- copy = kstrdup (label , GFP_KERNEL );
2411
- if (!copy )
2383
+ guard (spinlock_irqsave )(& gpio_lock );
2384
+
2385
+ if (!test_bit (FLAG_REQUESTED , & desc -> flags ))
2386
+ return NULL ;
2387
+
2388
+ label = kstrdup (desc -> label , GFP_KERNEL );
2389
+ if (!label )
2412
2390
return ERR_PTR (- ENOMEM );
2413
2391
2414
- return copy ;
2392
+ return label ;
2415
2393
}
2416
2394
EXPORT_SYMBOL_GPL (gpiochip_dup_line_label );
2417
2395
0 commit comments