Skip to content

Commit b178e7e

Browse files
AxelLinlinusw
authored andcommitted
gpio: brcmstb: Use list_for_each_entry at appropriate places
Use list_for_each_entry to simplify the code a bit. Signed-off-by: Axel Lin <[email protected]> Acked-by: Gregory Fong <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent f0d3c72 commit b178e7e

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/gpio/gpio-brcmstb.c

+4-9
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,14 @@ static void brcmstb_gpio_irq_handler(struct irq_desc *desc)
233233
struct gpio_chip *gc = irq_desc_get_handler_data(desc);
234234
struct brcmstb_gpio_priv *priv = brcmstb_gpio_gc_to_priv(gc);
235235
struct irq_chip *chip = irq_desc_get_chip(desc);
236-
struct list_head *pos;
236+
struct brcmstb_gpio_bank *bank;
237237

238238
/* Interrupts weren't properly cleared during probe */
239239
BUG_ON(!priv || !chip);
240240

241241
chained_irq_enter(chip, desc);
242-
list_for_each(pos, &priv->bank_list) {
243-
struct brcmstb_gpio_bank *bank =
244-
list_entry(pos, struct brcmstb_gpio_bank, node);
242+
list_for_each_entry(bank, &priv->bank_list, node)
245243
brcmstb_gpio_irq_bank_handler(bank);
246-
}
247244
chained_irq_exit(chip, desc);
248245
}
249246

@@ -280,7 +277,6 @@ static int brcmstb_gpio_sanity_check_banks(struct device *dev,
280277
static int brcmstb_gpio_remove(struct platform_device *pdev)
281278
{
282279
struct brcmstb_gpio_priv *priv = platform_get_drvdata(pdev);
283-
struct list_head *pos;
284280
struct brcmstb_gpio_bank *bank;
285281
int ret = 0;
286282

@@ -293,10 +289,9 @@ static int brcmstb_gpio_remove(struct platform_device *pdev)
293289
* You can lose return values below, but we report all errors, and it's
294290
* more important to actually perform all of the steps.
295291
*/
296-
list_for_each(pos, &priv->bank_list) {
297-
bank = list_entry(pos, struct brcmstb_gpio_bank, node);
292+
list_for_each_entry(bank, &priv->bank_list, node)
298293
gpiochip_remove(&bank->gc);
299-
}
294+
300295
if (priv->reboot_notifier.notifier_call) {
301296
ret = unregister_reboot_notifier(&priv->reboot_notifier);
302297
if (ret)

0 commit comments

Comments
 (0)