Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6aa7dbfa authored by Linus Walleij's avatar Linus Walleij
Browse files

gpio: mm-lantiq: use gpiochip data pointer



This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: John Crispin <blogic@openwrt.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 47315578
Loading
Loading
Loading
Loading
+3 −6
Original line number Original line Diff line number Diff line
@@ -61,9 +61,7 @@ static void ltq_mm_apply(struct ltq_mm *chip)
 */
 */
static void ltq_mm_set(struct gpio_chip *gc, unsigned offset, int value)
static void ltq_mm_set(struct gpio_chip *gc, unsigned offset, int value)
{
{
	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
	struct ltq_mm *chip = gpiochip_get_data(gc);
	struct ltq_mm *chip =
		container_of(mm_gc, struct ltq_mm, mmchip);


	if (value)
	if (value)
		chip->shadow |= (1 << offset);
		chip->shadow |= (1 << offset);
@@ -93,8 +91,7 @@ static int ltq_mm_dir_out(struct gpio_chip *gc, unsigned offset, int value)
 */
 */
static void ltq_mm_save_regs(struct of_mm_gpio_chip *mm_gc)
static void ltq_mm_save_regs(struct of_mm_gpio_chip *mm_gc)
{
{
	struct ltq_mm *chip =
	struct ltq_mm *chip = gpiochip_get_data(&mm_gc->gc);
		container_of(mm_gc, struct ltq_mm, mmchip);


	/* tell the ebu controller which memory address we will be using */
	/* tell the ebu controller which memory address we will be using */
	ltq_ebu_w32(CPHYSADDR(chip->mmchip.regs) | 0x1, LTQ_EBU_ADDRSEL1);
	ltq_ebu_w32(CPHYSADDR(chip->mmchip.regs) | 0x1, LTQ_EBU_ADDRSEL1);
@@ -122,7 +119,7 @@ static int ltq_mm_probe(struct platform_device *pdev)
	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,shadow", &shadow))
	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,shadow", &shadow))
		chip->shadow = shadow;
		chip->shadow = shadow;


	return of_mm_gpiochip_add(pdev->dev.of_node, &chip->mmchip);
	return of_mm_gpiochip_add_data(pdev->dev.of_node, &chip->mmchip, chip);
}
}


static int ltq_mm_remove(struct platform_device *pdev)
static int ltq_mm_remove(struct platform_device *pdev)