From patchwork Mon Nov 8 13:46:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12608417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FF4AC433EF for ; Mon, 8 Nov 2021 13:46:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 150C361177 for ; Mon, 8 Nov 2021 13:46:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 150C361177 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=QyylB96TnZ3nZlVS9qJ3gJDsnjIZDjVgY7uDLCTgWxk=; b=FrcloUs4uYwfEB LM/pCyj2hK9/XAMsmC3thv05PcwZF9wymghIo4EiU1QWmHY7X0WC+D5ahr5WkrlyOGNFfSKTDfQjP PDdIxx/jJEDH8M9+GPpz5HkwN9Eo8XAxTG2S+66DLS+VSllD8ChcxyuL+WHkNK1+Qyip90+Yv39MP knG1HvmNlFr0T8SHh+T1PR1sTkFoUaEIdMWo7SB3RgS/xrfzu3kTHjWPv7Uk9iwCD6v3Z2yQ2G8lt o765SaB7OVa8rEwHrIrQzu8Y8qg/k9GKt/TJ5Xuf9lc+4wWDcBwwtPtoGt6lLqPxwq8hNRwGnxsNG IjIaHq2ocmabqRVMRklQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk4yw-00GWar-OR; Mon, 08 Nov 2021 13:46:42 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk4ys-00GWZ2-7o for linux-amlogic@lists.infradead.org; Mon, 08 Nov 2021 13:46:40 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mk4yn-0004Ue-Kw; Mon, 08 Nov 2021 14:46:33 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mk4yl-000699-Tp; Mon, 08 Nov 2021 14:46:31 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mk4yl-0002ov-RJ; Mon, 08 Nov 2021 14:46:31 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding , Lee Jones Cc: Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 1/4] pwm: meson: Drop always false check from .request() Date: Mon, 8 Nov 2021 14:46:24 +0100 Message-Id: <20211108134628.120474-1-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; i=pFF+ThL4Urlu1TgeAT3wxZCnLMkalyqRs5xjfOsL+ZY=; m=nhk1f+7QpS0gg35JwXeZ3sqDXjYmbygGULsEVAtTKUQ=; p=u0Uw8z69fVb+Fwiw/oDyZ54AmbpstXAC/2Fa5ZfBsw0=; g=cf9f1f25cd7eecd9840378bff40eaedad4219019 X-Patch-Sig: m=pgp; i=u.kleine-koenig@pengutronix.de; s=0x0D2511F322BFAB1C1580266BE2DCDD9132669BD6; b=iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmGJKiUACgkQwfwUeK3K7Alk1QgAk5M isgUA5ScsDyvJfOEg8PQFmdzrTFRAijf9kGuZbRH1b9EIAMnqNeFEFQJBwIvguQV4o6wOu2E+plZF AcLwTAXGe8WojGf+46Ka/fU2FzXCAqsHZuVbqjQGrcdVXkUGX+SYBqL+xlsaPPFSxhuC/wW+aNOSI MO2TnS5p5oMAe75ReJMSsdbGgkISZXtUABKqqpmKlcjmZu1ou2K3Tiyj5YPQy+YOYQsnHkl5gXL59 18ggvXAtY0bi7rm0jtG7m+OTYzvJcYxSqT8Lh5y80ADuaJBKTTFXMSn+hhMzRq3HNcttViWm2OrDP bA7N+Z0UDSSV+igFgkBi+IGazmOWSxw== X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-amlogic@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211108_054638_354992_2F28C135 X-CRM114-Status: GOOD ( 11.67 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org In .request() pwm_get_chip_data() returns NULL always since commit e926b12c611c ("pwm: Clear chip_data in pwm_put()"). (And if it didn't returning 0 would be wrong because then .request() wouldn't reenable the clk which the other driver code depends on.) Signed-off-by: Uwe Kleine-König Reviewed-by: Martin Blumenstingl --- drivers/pwm/pwm-meson.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) base-commit: 6b75d88fa81b122cce37ebf17428a849ccd3d0f1 diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 3cf3bcf5ddfc..be3c806b57e4 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -120,16 +120,10 @@ static inline struct meson_pwm *to_meson_pwm(struct pwm_chip *chip) static int meson_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) { struct meson_pwm *meson = to_meson_pwm(chip); - struct meson_pwm_channel *channel; + struct meson_pwm_channel *channel = &meson->channels[pwm->hwpwm]; struct device *dev = chip->dev; int err; - channel = pwm_get_chip_data(pwm); - if (channel) - return 0; - - channel = &meson->channels[pwm->hwpwm]; - if (channel->clk_parent) { err = clk_set_parent(channel->clk, channel->clk_parent); if (err < 0) { From patchwork Mon Nov 8 13:46:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12608415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7629FC4332F for ; Mon, 8 Nov 2021 13:46:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D465661177 for ; Mon, 8 Nov 2021 13:46:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D465661177 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3ccnBQknCFdHNonIJCwcXpui3+gLxGos3x0lta4mXCk=; b=fS3A4f/7QN1hOy XJBuvf2z4Rx+HhWjBFtACAyE4iz/Wa/yWMD0+XkMz2oUq7WNZOYkNSqOO+B4ctyBB/Nxn8C7HyOVB f5/nL+UUoPOor89XAO6cMgOWtNLkk9uHT9mFwqCjOJZ8SheJb1f80D3FN5CXFUuQ70/WBMZC8e4O7 Q97vvDRfrYMjWHlPWam6o+kXUpzF9TVUDOrt/BxQnTiuQW143xtbVBDDfppKTTWwPraXAXMhQ33ou ir2hKQZhaGECD3W5tSlh8XPBaQrUlxCp6a3K3NIXxYZnjSW/uR3FvY2GlnBA1Oa6U6GxVtdPFTYiD 3IygzwffXs/twJZjIpfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk4yw-00GWai-3Q; Mon, 08 Nov 2021 13:46:42 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk4ys-00GWZ1-7n for linux-amlogic@lists.infradead.org; Mon, 08 Nov 2021 13:46:39 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mk4yn-0004Uf-Kw; Mon, 08 Nov 2021 14:46:33 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mk4ym-00069C-0m; Mon, 08 Nov 2021 14:46:32 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mk4yl-0002p8-W0; Mon, 08 Nov 2021 14:46:31 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding , Lee Jones Cc: Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 2/4] pwm: meson: Drop useless check for channel data being NULL Date: Mon, 8 Nov 2021 14:46:25 +0100 Message-Id: <20211108134628.120474-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211108134628.120474-1-u.kleine-koenig@pengutronix.de> References: <20211108134628.120474-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; i=WYWbEo0mdLasyONjA5l0Q8GW6ag2v1wA0HYDo9/eUbo=; m=3MDjJzoRh63117QhB/RgLRb8f8aNIyaZ/jAm+bicXOk=; p=Hw1bqdubrn8I4UHF0kD52flQxDKafxUj3KVtG+rMoPQ=; g=d11fe241c518b8a375ef3cda3e0d354bfe0bc0b4 X-Patch-Sig: m=pgp; i=u.kleine-koenig@pengutronix.de; s=0x0D2511F322BFAB1C1580266BE2DCDD9132669BD6; b=iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmGJKigACgkQwfwUeK3K7AmB0Qf/Y6E qXsMl91ssbdUh7Ztdip6h9FkWb4LZ0aFHtSo4M9fn9Y1pIZ7snFfXq4S+kqNISljAkLh4SfUehJA9 VAj3/IUVFdbf5RyZNEV8RvXH7/93DLQz13ZxoNKooHoNA/OuTAl1p5csZhaxeowUKD7A/pQsuZ/h/ nOEks7Js0kPMTl5Y56AzBbUvUm9QWmbZ2VDD5vVq3FeaF9lCiY4cqqUJ50k28OfTFYdyPuYX9uXYR vTGmc9CQu26voug2FKwPJej+Z0prDE7q850gf4JbUQEhArEVHl9HYoSqyEbbaINmg4eEFuZvJOF8/ jpCsUSFRU6bSFg2yu+llzki1lC4he8A== X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-amlogic@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211108_054638_360998_5DD7BA77 X-CRM114-Status: GOOD ( 11.61 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org In meson_pwm_free() the function pwm_get_chip_data() always returns a non-NULL pointer because it's only called when the request callback succeeded and this callback calls pwm_set_chip_data() in this case. Signed-off-by: Uwe Kleine-König Reviewed-by: Martin Blumenstingl --- drivers/pwm/pwm-meson.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index be3c806b57e4..1fbe54a2abfe 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -148,8 +148,7 @@ static void meson_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) { struct meson_pwm_channel *channel = pwm_get_chip_data(pwm); - if (channel) - clk_disable_unprepare(channel->clk); + clk_disable_unprepare(channel->clk); } static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm, From patchwork Mon Nov 8 13:46:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12608413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B841C433EF for ; Mon, 8 Nov 2021 13:46:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BADBE6115A for ; Mon, 8 Nov 2021 13:46:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BADBE6115A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QU5S+DgMJ7t2Ei7twJBllW2fembU/6MRhkunItEIGqc=; b=BgFPGdjyiOkwa9 fCQ8mvIsftG35CIH/RQxbXZHCxT+eQWQBOfEyx6hkcSQ+vPfWeXb1oB7OzYo+HUxGD3TaGCQ8mt0r 35WT/2t764RG+3mjbxTVKTxDAsMCl1jS1CHHiRoOSle99mbH+D2lt+4raiqDGQK6uBFm46MiLV4Ph yo3+VvFGWwg74/brr6XVOCz5c6lZgezdpDfNUnfddfikQiPpv9LxQdAlpXChoSbkbe9qK68i35qj5 JKhS5N0AaA/4177ykfpUJt5gYBL1C/zGWDtFtXrrDMAupQ1luFV+N3BtfmOSRpiZh7noFkrhuTxeF MKbGzAoResFOwwHSsxFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk4yx-00GWb1-DV; Mon, 08 Nov 2021 13:46:43 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk4ys-00GWZ0-7q for linux-amlogic@lists.infradead.org; Mon, 08 Nov 2021 13:46:41 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mk4yn-0004Ug-Kw; Mon, 08 Nov 2021 14:46:33 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mk4ym-00069F-5t; Mon, 08 Nov 2021 14:46:32 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mk4ym-0002pL-4o; Mon, 08 Nov 2021 14:46:32 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding , Lee Jones Cc: Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 3/4] pwm: meson: Simplify duplicated per-channel tracking Date: Mon, 8 Nov 2021 14:46:26 +0100 Message-Id: <20211108134628.120474-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211108134628.120474-1-u.kleine-koenig@pengutronix.de> References: <20211108134628.120474-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; i=rNZrjCvgYmAqlJ5riojVlnaxpCf4wtmwd9yLL/nP0PM=; m=5XgqPhF6+YixcIl9jZOqNtNzkP5opD+m/1BKa93KXaM=; p=wj2PEOpn/8zNM06wPsEr602+lpcO38hRz6y9qIvpvBg=; g=2eaf700f1bee0410d39a81c3eecddf3d6da7db05 X-Patch-Sig: m=pgp; i=u.kleine-koenig@pengutronix.de; s=0x0D2511F322BFAB1C1580266BE2DCDD9132669BD6; b=iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmGJKi0ACgkQwfwUeK3K7An8igf+INv cesPBBF3ca/KVzDkShBEJWZ1BVxrlZYKESmYp1sHbfMBtt2rAqQdGULLf70AYEiyzwi+5I4wPPrKk 9MyOapg0LS6ioCsC1ItQENjdArGwEybcHlx3uUNLPXPFatVe940MWOGbTA0NoDZoI907tysjtfAA6 6Iz1n58FZTyedYOjeyoJFOTEYSpITgd08jtD+morYCqD1h8sg/3fDWDcq9VkgDfeHHdrxnPgTa5mk izu2biIvenHBJ5eW53m5gkeyPQkFDde7S38uc01IPj+yM5AtPNH/37J+9Lg+2gYT12WYJCi84D52B lHkM7e1T4OsKs9ZVhX6R3NX2sMk8YPw== X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-amlogic@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211108_054638_357328_CB6EE26B X-CRM114-Status: GOOD ( 12.96 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org The driver tracks per-channel data via struct pwm_device::chip_data and struct meson_pwm::channels[]. The latter holds the actual data, the former is only a pointer to the latter. So simplify by using struct meson_pwm::channels[] consistently. Signed-off-by: Uwe Kleine-König Reviewed-by: Martin Blumenstingl --- drivers/pwm/pwm-meson.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 1fbe54a2abfe..908e314c7c00 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -141,12 +141,13 @@ static int meson_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) return err; } - return pwm_set_chip_data(pwm, channel); + return 0; } static void meson_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) { - struct meson_pwm_channel *channel = pwm_get_chip_data(pwm); + struct meson_pwm *meson = to_meson_pwm(chip); + struct meson_pwm_channel *channel = &meson->channels[pwm->hwpwm]; clk_disable_unprepare(channel->clk); } @@ -154,7 +155,7 @@ static void meson_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm, const struct pwm_state *state) { - struct meson_pwm_channel *channel = pwm_get_chip_data(pwm); + struct meson_pwm_channel *channel = &meson->channels[pwm->hwpwm]; unsigned int duty, period, pre_div, cnt, duty_cnt; unsigned long fin_freq; @@ -217,7 +218,7 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm, static void meson_pwm_enable(struct meson_pwm *meson, struct pwm_device *pwm) { - struct meson_pwm_channel *channel = pwm_get_chip_data(pwm); + struct meson_pwm_channel *channel = &meson->channels[pwm->hwpwm]; struct meson_pwm_channel_data *channel_data; unsigned long flags; u32 value; @@ -260,8 +261,8 @@ static void meson_pwm_disable(struct meson_pwm *meson, struct pwm_device *pwm) static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, const struct pwm_state *state) { - struct meson_pwm_channel *channel = pwm_get_chip_data(pwm); struct meson_pwm *meson = to_meson_pwm(chip); + struct meson_pwm_channel *channel = &meson->channels[pwm->hwpwm]; int err = 0; if (!state) From patchwork Mon Nov 8 13:46:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12608411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D96EC433FE for ; Mon, 8 Nov 2021 13:46:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB74A611C0 for ; Mon, 8 Nov 2021 13:46:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BB74A611C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FAqfiRTBhQaHdp/6jYdssup3XiV5qvwlmhSgt7X3LIA=; b=Bgwxp8qi6KIWFJ LfnWmYh5sRbzV6Utr8agEMaq83lnfYFo87PNP0ghoMDTukk9AoURhMIvMsAUNHPedrhVw7cX/vV44 DoDDBBFIjE45IfMuLCq34IakVURXjtuC50UG9/Bp4cpKxjaRGoe7GpVZzI1Q41/P0a6B4evNogwL1 +6X+UHxBq7zmUz9A3Inm/NzgjSldrRPgtaDfS8cuPzYeBDayoIf3h1YlW9OA8fTmxTozPWnsjo/Dw r9n5SC3FnAs9F+z9j1htLj4vbqK1saQBRiyZUoyrhflirroEKJtFGb9INgY0ednreUC2cBeSKnrIG 0kxjW2ioR5l77i2YmJrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk4yv-00GWab-EA; Mon, 08 Nov 2021 13:46:41 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk4ys-00GWYz-7r for linux-amlogic@lists.infradead.org; Mon, 08 Nov 2021 13:46:39 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mk4yn-0004Uh-Kw; Mon, 08 Nov 2021 14:46:33 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mk4ym-00069I-Bv; Mon, 08 Nov 2021 14:46:32 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mk4ym-0002pY-Ar; Mon, 08 Nov 2021 14:46:32 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding , Lee Jones Cc: Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 4/4] pwm: meson: Drop always false check from .apply() Date: Mon, 8 Nov 2021 14:46:27 +0100 Message-Id: <20211108134628.120474-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211108134628.120474-1-u.kleine-koenig@pengutronix.de> References: <20211108134628.120474-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; i=t6nqP68umcfgl2LMMZu5wgSXv5y7BP8Yq//bo4VIgNc=; m=jGsFlekQ+2yilMcwc32RAz5K+wnk4VawfE73mj0m3qI=; p=LtpYs78wmQ0R8LbrvctrXoYoGhL69XWeqyaBE8SxIKQ=; g=6e7fe3eec186f73a06b22fddee4682d34beb692b X-Patch-Sig: m=pgp; i=u.kleine-koenig@pengutronix.de; s=0x0D2511F322BFAB1C1580266BE2DCDD9132669BD6; b=iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmGJKjEACgkQwfwUeK3K7AnGYgf+Imt 8va6K+BIAFvqfU0/lfExarhVnwqBGy4vN3UTLXOdGJiHvcNyNKQ7tiWxf36QX/OYE5sLFNUg14jRN 4NysbBguwGipT/92RLdXOiyz++lGogPl3OrgH39bkC5AiLo0YAhK6cjRk3nMLKn7aU0ypA67FNXzx hq8xl6Af+wIWC38CBtxY/RoYqGFZQuRDY21S4C10WXQzmmgqxPOw1ujAqIvkXxKCOexCV1eEWM7+e axAGEA2AzpvfsRJzpie/G3het+OeqO229bf+icyDAgd6MrS0yodTZc1kq5HTw1eIF/eJAvueBHPUZ y0yixS5fDaPAIAKwbqSW0c3r0VlN+3Q== X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-amlogic@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211108_054638_354995_BF597614 X-CRM114-Status: GOOD ( 10.53 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org The pwm core only calls the apply callback with a valid state pointer, so don't repeat this check already done in the core. Signed-off-by: Uwe Kleine-König Reviewed-by: Martin Blumenstingl --- drivers/pwm/pwm-meson.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 908e314c7c00..57112f438c6d 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -265,9 +265,6 @@ static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, struct meson_pwm_channel *channel = &meson->channels[pwm->hwpwm]; int err = 0; - if (!state) - return -EINVAL; - if (!state->enabled) { if (state->polarity == PWM_POLARITY_INVERSED) { /*