Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5669866pxu; Wed, 23 Dec 2020 02:25:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8WpMDvcWRnoahmwE4a7ubw2AgS9vasAwEZ3B3xGsghrqJorcARhjWkaGjn7mI09PetOZe X-Received: by 2002:a50:9f4e:: with SMTP id b72mr24362905edf.200.1608719108202; Wed, 23 Dec 2020 02:25:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608719108; cv=none; d=google.com; s=arc-20160816; b=g5qXVw0m3AMubjGQ3t1WnuBzfRNOZGnT+bhcaAGo3P5QsJvRdXoc++MPYk1nQ/3y0U UlBZ2sUfDmOcNaem1UulByWrdFF4DuJYYIL4iFiW5H+FyffWZTBsPHe9Oto+3Z7yCFQZ cGndYzhDDdEFQEOm8EARimunCWfep4YyWdAhIG2NSqFdT5llRP9VhjjYe+ZQeOg4G924 QalwC57DZrn2TQ+EO3f7QaXS0waotXhhquONH8w8tLvZ3LYi9V8hwtnLGwuvYK+rnIxS 5xqIXbqz1cdfH5BUHyAouoGu2EOdszr5VkWneimBnxixbgbtXPM9OgDQf9Mzy6CWfGGh CQZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=nfxY8fAfhUye0vToMWMEwM6YlH2XUXHY0gZo5C9djQc=; b=iqCzOrc9eR/1uSInFcK+bTflE9jR/g1+RXp3DW2suFRJhSnN+uYjLTxSv1truCYbqC l2I6KLGwjQ4k9BWJaOwPjukwstSrf44AtYf1pMEhuZK8qySiwrPnW+wkAgv2IPHMXG/6 EMO+Wv94M/YKBMyEe7Wx9f41BVYBZuILF0h9EVfkoTrT4jYHyBJVdbXK4yojyiXGNCzf 0hfBKf1veofAjVNdemTeplpT/PucOV+lGHWrBFc8h/a6tqwzSRwCXNMXeVI1YL5+2rCS rEnxrfJmoU1G+0M5V156pLpIAeqaAalOfGC1Gge+7S5AwfyjCPp7avcfxaCnwuu5HXb+ E6Jg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si470605ejn.628.2020.12.23.02.24.45; Wed, 23 Dec 2020 02:25:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728363AbgLWKXX (ORCPT + 99 others); Wed, 23 Dec 2020 05:23:23 -0500 Received: from relmlor1.renesas.com ([210.160.252.171]:7007 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728341AbgLWKXW (ORCPT ); Wed, 23 Dec 2020 05:23:22 -0500 X-IronPort-AV: E=Sophos;i="5.78,441,1599490800"; d="scan'208";a="66928591" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 23 Dec 2020 19:22:49 +0900 Received: from localhost.localdomain (unknown [10.166.252.89]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D22614255D30; Wed, 23 Dec 2020 19:22:49 +0900 (JST) From: Yoshihiro Shimoda To: marek.vasut+renesas@gmail.com, lee.jones@linaro.org, matti.vaittinen@fi.rohmeurope.com, lgirdwood@gmail.com, broonie@kernel.org, linus.walleij@linaro.org, bgolaszewski@baylibre.com Cc: khiem.nguyen.xt@renesas.com, linux-power@fi.rohmeurope.com, linux-gpio@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH v6 07/12] gpio: bd9571mwv: rid of using struct bd9571mwv Date: Wed, 23 Dec 2020 19:22:38 +0900 Message-Id: <1608718963-21818-8-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1608718963-21818-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1608718963-21818-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To simplify this driver, use dev_get_regmap() and rid of using struct bd9571mwv. Signed-off-by: Yoshihiro Shimoda Reviewed-by: Matti Vaittinen --- drivers/gpio/gpio-bd9571mwv.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-bd9571mwv.c b/drivers/gpio/gpio-bd9571mwv.c index abb622c..0e5395f 100644 --- a/drivers/gpio/gpio-bd9571mwv.c +++ b/drivers/gpio/gpio-bd9571mwv.c @@ -16,8 +16,8 @@ #include struct bd9571mwv_gpio { + struct regmap *regmap; struct gpio_chip chip; - struct bd9571mwv *bd; }; static int bd9571mwv_gpio_get_direction(struct gpio_chip *chip, @@ -26,7 +26,7 @@ static int bd9571mwv_gpio_get_direction(struct gpio_chip *chip, struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip); int ret, val; - ret = regmap_read(gpio->bd->regmap, BD9571MWV_GPIO_DIR, &val); + ret = regmap_read(gpio->regmap, BD9571MWV_GPIO_DIR, &val); if (ret < 0) return ret; if (val & BIT(offset)) @@ -40,8 +40,7 @@ static int bd9571mwv_gpio_direction_input(struct gpio_chip *chip, { struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip); - regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_DIR, - BIT(offset), 0); + regmap_update_bits(gpio->regmap, BD9571MWV_GPIO_DIR, BIT(offset), 0); return 0; } @@ -52,9 +51,9 @@ static int bd9571mwv_gpio_direction_output(struct gpio_chip *chip, struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip); /* Set the initial value */ - regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_OUT, + regmap_update_bits(gpio->regmap, BD9571MWV_GPIO_OUT, BIT(offset), value ? BIT(offset) : 0); - regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_DIR, + regmap_update_bits(gpio->regmap, BD9571MWV_GPIO_DIR, BIT(offset), BIT(offset)); return 0; @@ -65,7 +64,7 @@ static int bd9571mwv_gpio_get(struct gpio_chip *chip, unsigned int offset) struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip); int ret, val; - ret = regmap_read(gpio->bd->regmap, BD9571MWV_GPIO_IN, &val); + ret = regmap_read(gpio->regmap, BD9571MWV_GPIO_IN, &val); if (ret < 0) return ret; @@ -77,7 +76,7 @@ static void bd9571mwv_gpio_set(struct gpio_chip *chip, unsigned int offset, { struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip); - regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_OUT, + regmap_update_bits(gpio->regmap, BD9571MWV_GPIO_OUT, BIT(offset), value ? BIT(offset) : 0); } @@ -105,9 +104,9 @@ static int bd9571mwv_gpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gpio); - gpio->bd = dev_get_drvdata(pdev->dev.parent); + gpio->regmap = dev_get_regmap(pdev->dev.parent, NULL); gpio->chip = template_chip; - gpio->chip.parent = gpio->bd->dev; + gpio->chip.parent = pdev->dev.parent; ret = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio); if (ret < 0) { -- 2.7.4