From patchwork Fri Dec 23 15:38:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 36296 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp383987wrn; Fri, 23 Dec 2022 07:40:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXskXZr087yAdy/C+cybYSKNYpWpRJDWsShL7Tx+JANekViFyl+5me4yzS1Rbb7onnXC4RbM X-Received: by 2002:a50:fc97:0:b0:482:b5b3:9127 with SMTP id f23-20020a50fc97000000b00482b5b39127mr628461edq.35.1671810008836; Fri, 23 Dec 2022 07:40:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671810008; cv=none; d=google.com; s=arc-20160816; b=T1YWUCT0VAtWuTXjOpaorGZguwYX1XtuUG/q9qiunGAzje2ibFZZd9feF9CxyXvvk0 Zposn/vTZk4RqlWPP0/WLFM+XINVXf4W61Gmgh/uTP+EVSbqFcpAK2ue7RvnKB86vZ7m ALUOtREBN637wmGRDMKLHjglhE/clSTshbN3g7q2lmzh4TguuepGgJrZupkI1/z5eXub C5hFiyUdN6b8McFcTKFf835MhgnFP2VY9/gCgZki4gv3MXx+vsUeoxECGpqUYUV0jYxi Er17wxbFr1t82oV5pnrfh1PhKGOgyPiaKeO7wbMUKJAqUi4SiBZaOPwIs2tV7DXw31q0 1W0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=62ZS7JkYul2m8VHv1f4RSJBR/i75r0mH9YhXsFCm5ng=; b=Cc8DGVf7XPDJPGdM9A+SgwBVKzIrI7nvXuaHuaXJRssNe1HTx+WSmhUpNVg6Kn85Ow QDxpT2KVqHA8d9D+cxyvmbzMr8NlOVO7o0J94Q/3pGZ4Heqro5uRn1xSWwTOaORtojVh kLS4efms97JI+SP8PPlkeC8qPacCb6mP45gaXrkwOLfP3e3J+oEIRWKZBwZ8I5yNSTYe yHBvR2KqUnu18NWdIRhKWwY9Ty0N3eXaXSmUydyqy/xZWsgveZiKQiPPnS3lnczoMU/6 2/uOgQpgD7o3VFfLAAp+YUKkeTw80EpneM23Q0McZk9bgzvTRdrM+daOsv6nuKzpEUA3 8TBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=kkNBCyTD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb11-20020a0564020d0b00b0046eff871046si3519574edb.367.2022.12.23.07.39.44; Fri, 23 Dec 2022 07:40:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=kkNBCyTD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229937AbiLWPit (ORCPT + 99 others); Fri, 23 Dec 2022 10:38:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236328AbiLWPia (ORCPT ); Fri, 23 Dec 2022 10:38:30 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EEEC44948 for ; Fri, 23 Dec 2022 07:38:29 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id h7so4897182wrs.6 for ; Fri, 23 Dec 2022 07:38:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=62ZS7JkYul2m8VHv1f4RSJBR/i75r0mH9YhXsFCm5ng=; b=kkNBCyTDnoMYXmE+0z0ruJGNOmPedCYqRQg9Z2I2JpHduRO843zCdWs9Vio4cgOBw8 71h1Cvoyr+Z/YAM6n+4vvf+gYit3f0ffbrqKPs++M7j47yE7tKJ3nW+FVmn2jXOuaIi3 TjVYYo1ZWSGkuLdvZDStRP2MiDt0DsGFzS7ald0dbMv2sAAjNQ60aCyjyQYZ+q9pokpS VNrbxnVU0BJfq8+nmJ3nSkTt8FoUUffj5xNVLA2XoQW3WtJpQIeZ0FPO1eU1RXsyUy12 0IQh07jo6D7zREz/vJ8EzeVI5tkztX3ndIotAOfE2TzQF8ZLBwIc6E2VSV3I3JkdiHF9 o+gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=62ZS7JkYul2m8VHv1f4RSJBR/i75r0mH9YhXsFCm5ng=; b=RwFgBvLzkMtsKg22DOTyCDMwzqdWeWeb1jivX61SAjb6lBUJ2mIOFHP/hz76xVVsgR TrTUA1ZfFPjetv3Cku/2OY7G5+8ikX6pdVNuq43y2jM7jpVJPJDYkhLdImWEph5HjXpQ 9G2mZ0PRVxRdsrkQhIQHTJ3hWR4avBNjdIMvHYKRY2MqLa1BZWbAZCDRylwdf0igwg+L e7dDQVIjQGC/ILyiFApls96hpZVetSA3rqVzBOWoS08RqqsTCEhvdFNF7/ksOm2SPCAx YvbLd40NPxeJCJHEMgSNNQqv8iEhPGsBhf4V34mFJxjM8HOqTsvgP8NkE0SCdti3UDyy ZfnQ== X-Gm-Message-State: AFqh2ko1Lx+mAdBa0YGtiuYtwgFNMSswHe5aZKKUBJmjfM9yQSVDR9q4 nV/fD69vpL+my0qH3h7k+ek1KA== X-Received: by 2002:a5d:58fc:0:b0:242:7f6e:9192 with SMTP id f28-20020a5d58fc000000b002427f6e9192mr6618305wrd.52.1671809907978; Fri, 23 Dec 2022 07:38:27 -0800 (PST) Received: from rainbowdash.. (cpc152649-stkp13-2-0-cust121.10-2.cable.virginm.net. [86.15.83.122]) by smtp.gmail.com with ESMTPSA id m5-20020adfc585000000b00236488f62d6sm3491610wrg.79.2022.12.23.07.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Dec 2022 07:38:27 -0800 (PST) From: Ben Dooks To: linux-pwm@vger.kernel.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lee Jones , u.kleine-koenig@pengutronix.de, Thierry Reding , Krzysztof Kozlowski , Greentime Hu , jarkko.nikula@linux.intel.com, William Salmon , Jude Onyenegecha , Ben Dooks Subject: [PATCH v7 05/10] pwm: dwc: use devm_pwmchip_add Date: Fri, 23 Dec 2022 15:38:15 +0000 Message-Id: <20221223153820.404565-6-ben.dooks@sifive.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221223153820.404565-1-ben.dooks@sifive.com> References: <20221223153820.404565-1-ben.dooks@sifive.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753019851728580521?= X-GMAIL-MSGID: =?utf-8?q?1753019851728580521?= Use devm_pwmchip_add() to add the pwm chip to avoid having to manually remove it (useful for the next patch which adds the platform-device support). Signed-off-by: Ben Dooks Reviewed-by: Uwe Kleine-König --- drivers/pwm/pwm-dwc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c index 61f11e0a9319..56cde9da2c0e 100644 --- a/drivers/pwm/pwm-dwc.c +++ b/drivers/pwm/pwm-dwc.c @@ -242,7 +242,7 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) return -ENOMEM; } - ret = pwmchip_add(&dwc->chip); + ret = devm_pwmchip_add(dev, &dwc->chip); if (ret) return ret; @@ -254,12 +254,8 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) static void dwc_pwm_remove(struct pci_dev *pci) { - struct dwc_pwm *dwc = pci_get_drvdata(pci); - pm_runtime_forbid(&pci->dev); pm_runtime_get_noresume(&pci->dev); - - pwmchip_remove(&dwc->chip); } #ifdef CONFIG_PM_SLEEP