From patchwork Thu Apr 19 08:29:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 133707 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp366434ljf; Thu, 19 Apr 2018 01:30:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx49ip+eGIexE33cAZi1MC5eVNq7Sz6eYRXpdY4jsKKdba9R7NCYXV3p3VahllA9UpwGwQx++ X-Received: by 10.101.88.140 with SMTP id d12mr4334388pgu.408.1524126604782; Thu, 19 Apr 2018 01:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524126604; cv=none; d=google.com; s=arc-20160816; b=QWjVjdyoUl9s5w4uQjo6RXLmI1vHCUnAvch87KgGvdZr/2gMF3eG7RuQY3NJDwndEg HrVaJ30iy5hmBnAsUgqZq8XJYTOGmWGWzqX+pfo8rjqzDcKiYWBAXkciiLH/0/LyJzff bEe8FWIGHpg9WbHNR9b+4zaq12aYJbMssAqixEl7QeZCdpyAMX7iv3vhoSLtktNCcIYV UKjuNZ017CXhg+IV59NtzWKIov45iN22dpui0wxrzh0uocxmvDKhSzDbGx8QKiQL66aJ Sy7bW10hGKr85XZtANIja0kuTLKfuYsH6WvZReKE2M5L116IJ3D23b4xhTTqSBXWBS1A zCwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=gkCdpgwlwR2KwOksooghWpXflEA0MoeOalg184k935A=; b=bcd2bG9JoovZZmuptt+fJG2r0BYjAmDv+Jc8/2JvkViHjtAS4pPRg/bvmGvwV6svaM fvmsdlJ8bXvSZJ2ME4cCBMJOtkY3Dd6SlmkEwfDkC3yl88HGf5mj0vjnF7ypzUuMOMen yukiSGb7bl5U/X53f9MHBiRDDtATyULaJOqvUGI3DG3dagIiEyAZ6mnxXdS6uhzvbxHz KLgeia2WXYj6miBMKIxc86lQXC2i90/qfKfkgbyhhlx1fXUo9tTT0iCG0O+g/5f8Y0Nv flfwjwYKuS/iFZ1gbYT6b8tC0pxeZYm3pW8KJtE75iQp4mRRnwzvF9ZCpDtkpeZZBazN vWog== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VaWrT9cp; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x11-v6si2965543plv.149.2018.04.19.01.30.04; Thu, 19 Apr 2018 01:30:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VaWrT9cp; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751092AbeDSIaD (ORCPT + 5 others); Thu, 19 Apr 2018 04:30:03 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:46848 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750980AbeDSIaC (ORCPT ); Thu, 19 Apr 2018 04:30:02 -0400 Received: by mail-lf0-f66.google.com with SMTP id j68-v6so6516810lfg.13 for ; Thu, 19 Apr 2018 01:30:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=fBI6bwwFRMFQ+oxmHdGV9yAxF0GRs5iTdewRGOGxhjQ=; b=VaWrT9cp4NqeHg1EPJwrAwzvRKNBlg41us3/RXU0/lpYRfcbVj8Aw9lQJKeM7aNpZ8 fLDg8SvZWiQXv90J4fCgxXoPVC3ARu41IymXsU2Lcj81P7ZUEcyg6BZ/H1SAN+d5JATu w8jMUUxNPpoB2+dpJRPADwpUn9MRO/JzgWBRk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fBI6bwwFRMFQ+oxmHdGV9yAxF0GRs5iTdewRGOGxhjQ=; b=OPK3Mv6Z5Rwa0R6RnwPcezP/CU6Y0ByqFAmnX1bzmS3HzNfps6beJDEFvroIALUN39 gVABCuwfs4SkXbHFrwDEzFNEuv6O7taFrgBSPIpIUv7JPxVikGHx7l9mEJHHcb0YaDCg F0bQT9FfnYebfyhPHEGyMZUxC5IJu/iECqHZoJgnE+CIcW8n6bIrXouz+EHxw7Z6pur9 Oh+XBGgVCw9lEgYQNNq3MsngDcGMcnLqalyACeXFRFX6x8f0EaYJRGw9j/LNEQeYUnAH /pWj524kzaEZIEXu+f/AO1vbrwmvRSMCpcTWlqTAbwono2G8guPB4S2pajHNHwufb27d W5lw== X-Gm-Message-State: ALQs6tAUYs0q135UrPNpo+xTnvyVechPeNwFXUGcJ9wCuNEtmuLYhvkH qWNBDzlSvxQvs8McxHrgbA5Br00nes8= X-Received: by 10.46.136.7 with SMTP id x7mr3455669ljh.124.1524126601144; Thu, 19 Apr 2018 01:30:01 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id p13sm496545ljc.19.2018.04.19.01.29.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Apr 2018 01:30:00 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij , Gregory CLEMENT , Thomas Petazzoni , Jason Cooper Subject: [PATCH] gpio: mvebu: Use the proper APIs Date: Thu, 19 Apr 2018 10:29:58 +0200 Message-Id: <20180419082958.6055-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The MVEBU driver is requesting GPIO descriptors from itself, which is fine, but we have proper APIs to do this in a controlled way, so stop calling into the private functions of the GPIO library and use the gpiochip_* functions instead. Only include and since we are both producers and consumers in this case. Cc: Gregory CLEMENT Cc: Thomas Petazzoni Cc: Jason Cooper Signed-off-by: Linus Walleij --- drivers/gpio/gpio-mvebu.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) -- 2.14.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 45c65f805fd6..6e02148c208b 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -36,7 +36,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -51,8 +52,6 @@ #include #include -#include "gpiolib.h" - /* * GPIO unit register offsets. */ @@ -608,19 +607,16 @@ static int mvebu_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) if (mvpwm->gpiod) { ret = -EBUSY; } else { - desc = gpio_to_desc(mvchip->chip.base + pwm->hwpwm); - if (!desc) { - ret = -ENODEV; + desc = gpiochip_request_own_desc(&mvchip->chip, + pwm->hwpwm, "mvebu-pwm"); + if (IS_ERR(desc)) { + ret = PTR_ERR(desc); goto out; } - ret = gpiod_request(desc, "mvebu-pwm"); - if (ret) - goto out; - ret = gpiod_direction_output(desc, 0); if (ret) { - gpiod_free(desc); + gpiochip_free_own_desc(desc); goto out; } @@ -637,7 +633,7 @@ static void mvebu_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) unsigned long flags; spin_lock_irqsave(&mvpwm->lock, flags); - gpiod_free(mvpwm->gpiod); + gpiochip_free_own_desc(mvpwm->gpiod); mvpwm->gpiod = NULL; spin_unlock_irqrestore(&mvpwm->lock, flags); }