[PATCH 4/4] staging: mt7621-gpio: use devm_kasprintf to set gpio banks labels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of using a custom function to return desired name for gpio
use the default assigned one and concat it '-bankN' suffix using
devm_kasprintf kernel function.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx>
---
 drivers/staging/mt7621-gpio/gpio-mt7621.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 1b4588a..d7256b5 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -196,15 +196,6 @@ static struct irq_chip mediatek_gpio_irq_chip = {
 	.irq_set_type		= mediatek_gpio_irq_type,
 };
 
-static inline const char * const mediatek_gpio_bank_name(int bank)
-{
-	static const char * const bank_names[] = {
-		"mt7621-bank0", "mt7621-bank1", "mt7621-bank2",
-	};
-
-	return bank_names[bank];
-}
-
 static int
 mediatek_gpio_xlate(struct gpio_chip *chip,
 		    const struct of_phandle_args *spec, u32 *flags)
@@ -251,7 +242,8 @@ mediatek_gpio_bank_probe(struct platform_device *pdev,
 
 	rg->chip.of_gpio_n_cells = 2;
 	rg->chip.of_xlate = mediatek_gpio_xlate;
-	rg->chip.label = mediatek_gpio_bank_name(rg->bank);
+	rg->chip.label = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-bank%d",
+					dev_name(&pdev->dev), bank);
 
 	ret = devm_gpiochip_add_data(&pdev->dev, &rg->chip, gpio);
 	if (ret < 0) {
-- 
2.7.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux