Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp431891pxb; Wed, 1 Sep 2021 02:04:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFLP+KOVQF1APOuVvF2ULJdXnImCLPgD0IgVG0vgkFsIjlzHinsui49MGjaBfzCK+pAd1r X-Received: by 2002:a17:906:8542:: with SMTP id h2mr5799988ejy.292.1630487048114; Wed, 01 Sep 2021 02:04:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630487048; cv=none; d=google.com; s=arc-20160816; b=p6zf6CWlW/WJIzDztaqWJZwIuyMX6+l0gbLCfXtNo0EFzf93e8DvF/MLS1mXrpsWX/ cTDuqqrIMp7RCWKRLnEUJxxLFEZ1xeZeqCSnNgZ5ZqIXFBpnT81oKJjXLbZEDQwvKU5V D0ZpwsZKcVmLZMSGEp/C1gkmrS4iX0UBGY4ZDCu9S92htxw9DAjRy2YxClBtCMNCsOsb RRjQB062D1VP5hY4YyrT9jcncRRlnOLZDS9yFowMp/rljZBFLWJU88asIGpQc/HjbQ9+ R1fa2e/FiWQQ1f3qQJPhnzqOD1gKkKB6Lb5SWf3BiE5hnH/wPax0toa8RYXoHIOfMyCC HoKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=IlwX8nTVZMke3Qb7azzyOJ0HAYdpebSqH46t9RnmaaY=; b=sMRODkZQj12Rhwvnf4VLRbBXlLxXmaSUTKDc6hbQdC8OD6puDvJAtoMacWqnVYIfjS hKcj5w0Zn4c5mW2JzkRkWUgyWZwWh7WOJVzKWqG0aMKPDJcIg2RyNGl1loEvRl+6B+EE SjcbRFX1g+ioLhHmbBl2zTdBBD7UFEAlvVZHJDXcmgb7RL2ivCCBpLzkStR69q1QigSC 0TEMOOIydcK3gXS1subnCZua5iwQ33LJG8HuYNWpEgo0YC30drTikXsU/eIFXxEvOTR6 bV6d01BLCjJE2Y+bAaqosQ610HxOuhTI/t9kOKXqiIQhMFRmz4WCRsnNbLUJQRjic8jg m1GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DzJxNfbO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p12si3026917ejy.328.2021.09.01.02.03.07; Wed, 01 Sep 2021 02:04:08 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DzJxNfbO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241677AbhIAI7K (ORCPT + 99 others); Wed, 1 Sep 2021 04:59:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:45798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239509AbhIAI7J (ORCPT ); Wed, 1 Sep 2021 04:59:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2674A61075 for ; Wed, 1 Sep 2021 08:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630486693; bh=ZcSl8QL3Am4u64j0N4jzg6z8iqyPZvH/GTxd9dmID44=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=DzJxNfbO4d1POC9HiOg6GTVB2nb79d7u6Gk9zibLhwQ7FsfDg2hcRjjf2axLvu+a1 NKuHrWlmWwDsqfERS1v58hEYgNvotYdqf3IXmxNEVsMjWwZHv/a4kaWZJnwkuE0e/I ErWiNd4Xv3XgeatW0ppkBrfsp8SLJyeUnval/M4Zy+wwoJtkmPZ3Joy8g7lok9YHN0 HbkFCEpW8J3aDEpMun+eZduhFcy+VgQ0ZhaNYMEQauTEtAo/yQdoJ4wcR4h2GoeUYs 0FXuZ2SPswV8DnogdWOjcirnKrnxcAiLgeSnvwAhhenUdfFGFyz2dJdB2+tDwI9Ht9 gWY/BqCtfdsPA== Received: by mail-pf1-f178.google.com with SMTP id m26so1521592pff.3 for ; Wed, 01 Sep 2021 01:58:13 -0700 (PDT) X-Gm-Message-State: AOAM531rO5qCySD7mXcr6BtjKrtujvx7xS4kjjwo3PJmkptkjctcTwjS aAMrPnCo2zjag9z5m0fYqtAN4NXaHZkUu77KfzI= X-Received: by 2002:aa7:8116:0:b029:346:8678:ce26 with SMTP id b22-20020aa781160000b02903468678ce26mr32911123pfi.15.1630486692769; Wed, 01 Sep 2021 01:58:12 -0700 (PDT) MIME-Version: 1.0 References: <20210831125159.29282-1-zhaoxiao@uniontech.com> In-Reply-To: <20210831125159.29282-1-zhaoxiao@uniontech.com> From: Krzysztof Kozlowski Date: Wed, 1 Sep 2021 10:58:01 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] pwm: rockchip: Simplify using devm_pwmchip_add() To: zhaoxiao Cc: thierry.reding@gmail.com, lee.jones@linaro.org, heiko@sntech.de, u.kleine-koenig@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 31 Aug 2021 at 14:52, zhaoxiao wrote: > > With devm_pwmchip_add() we can drop pwmchip_remove() from the device > remove callback. The latter can then go away, too and as this is the > only user of platform_get_drvdata(), the respective call to > platform_set_drvdata() can go, too. > > Signed-off-by: zhaoxiao > --- > drivers/pwm/pwm-rockchip.c | 29 +---------------------------- > 1 file changed, 1 insertion(+), 28 deletions(-) > > diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c > index cbe900877724..c22856916e63 100644 > --- a/drivers/pwm/pwm-rockchip.c > +++ b/drivers/pwm/pwm-rockchip.c > @@ -347,8 +347,6 @@ static int rockchip_pwm_probe(struct platform_device *pdev) > goto err_clk; > } > > - platform_set_drvdata(pdev, pc); > - > pc->data = id->data; > pc->chip.dev = &pdev->dev; > pc->chip.ops = &rockchip_pwm_ops; > @@ -358,7 +356,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev) > ctrl = readl_relaxed(pc->base + pc->data->regs.ctrl); > enabled = (ctrl & enable_conf) == enable_conf; > > - ret = pwmchip_add(&pc->chip); > + ret = devm_pwmchip_add(&pdev->dev, &pc->chip); > if (ret < 0) { > dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret); > goto err_pclk; > @@ -380,37 +378,12 @@ static int rockchip_pwm_probe(struct platform_device *pdev) > return ret; > } > > -static int rockchip_pwm_remove(struct platform_device *pdev) > -{ > - struct rockchip_pwm_chip *pc = platform_get_drvdata(pdev); > - > - /* > - * Disable the PWM clk before unpreparing it if the PWM device is still > - * running. This should only happen when the last PWM user left it > - * enabled, or when nobody requested a PWM that was previously enabled > - * by the bootloader. > - * > - * FIXME: Maybe the core should disable all PWM devices in > - * pwmchip_remove(). In this case we'd only have to call > - * clk_unprepare() after pwmchip_remove(). > - * > - */ > - if (pwm_is_enabled(pc->chip.pwms)) > - clk_disable(pc->clk); > - > - clk_unprepare(pc->pclk); > - clk_unprepare(pc->clk); NAK, for the same reason as pwm_samsung. Please test your patches. Best regards, Krzysztof