Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3309887imj; Tue, 19 Feb 2019 00:56:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IbYrPtFtAYdgk6moLTGZ/cwmOUqjxIkvIvvNDJQuZAqs6SwziW5F2oRtajzZCy5oMGkmAWp X-Received: by 2002:a63:4287:: with SMTP id p129mr1006109pga.84.1550566597671; Tue, 19 Feb 2019 00:56:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550566597; cv=none; d=google.com; s=arc-20160816; b=iaDEtkW6U7LuRKALQih7WrodRSL5Zg7Lzxf4RjZNTOduIGkVQPxl4IC1EV9+PmBx8p drXmOgKBfe7JlYe6J287kRpR7624DhqS/YRm0s6Gl4vVl2CBv0vZVLlwZbZEZBM5icQc hBQE2Af6JaWmN3FoIAdTybAH+6287mBhZ1xrki/6aTGLN1wS+i2n+KYUwwSrByDSvJa5 dImOeXOFyOvnd8dMLTKvyG0aPN25Q3i7hPRWam+fTCugt4bPkDSpLFsHvOUnQwPPp2AN bSrbv4zMmQui7j8Aqsl27GrV9uEa6HlsvBdtOY8zpyi4zkiUKfj15iMUsPMjQfnOkgQu InfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=f5T8Qm9hPnOLrUrg1dxglF1SbzJ744W1GM0tPEdFqQQ=; b=zvhm/IJNoMYR1sbPWXEcPyKufKx+nF70OO/qKABz7ss5s+bYcnJIyD8ft1hZ8r6m0D FAJ2seETUrHFjxdJoyI1T6weKCvUIl7pPWWPuidwWCTv0mf3xndTf2VN6Os2Cp1LX1C9 0Rqk3+/zbp9Ja43JLDb743JzrfAHnYf7HVE8AdzJabPWKfBYM+oiLlhrYQhYez153LMV XZM41jqCr6WsypwnfIl82IuQqbOpTsXD9+2IuQL8fiCMQHYybziCYunpGqI2K/uy7/p/ NIR1ny4ESKN/Q/E/dP+ySuSH+sCHgyNc15oxVLRzlLmpjs63gSiXfMW3HKXRB92QAjsG lGDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k194si8272629pgc.94.2019.02.19.00.56.22; Tue, 19 Feb 2019 00:56:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727582AbfBSIzY (ORCPT + 99 others); Tue, 19 Feb 2019 03:55:24 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:43561 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727242AbfBSIzY (ORCPT ); Tue, 19 Feb 2019 03:55:24 -0500 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gw1BO-0003qJ-H8; Tue, 19 Feb 2019 09:55:18 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1gw1BM-0004ss-Ho; Tue, 19 Feb 2019 09:55:16 +0100 Date: Tue, 19 Feb 2019 09:55:16 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Fabrice Gasnier Cc: thierry.reding@gmail.com, robh+dt@kernel.org, tduszyns@gmail.com, mark.rutland@arm.com, alexandre.torgue@st.com, mcoquelin.stm32@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: Re: [PATCH v4 3/3] pwm: core: add consumer device link Message-ID: <20190219085516.dz5ux37kdszqkisy@pengutronix.de> References: <1550139951-25788-1-git-send-email-fabrice.gasnier@st.com> <1550139951-25788-4-git-send-email-fabrice.gasnier@st.com> <20190218172223.lw3e5tn5hzsow6tg@pengutronix.de> <53bc3d80-8732-46be-caef-015998c9ad0e@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <53bc3d80-8732-46be-caef-015998c9ad0e@st.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 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-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 19, 2019 at 09:46:32AM +0100, Fabrice Gasnier wrote: > On 2/18/19 6:22 PM, Uwe Kleine-K?nig wrote: > > Hello, > > > > On Thu, Feb 14, 2019 at 11:25:51AM +0100, Fabrice Gasnier wrote: > >> Add a device link between the PWM consumer and the PWM provider. This > >> enforces the PWM user to get suspended before the PWM provider. It > >> allows proper synchronization of suspend/resume sequences: the PWM user > >> is responsible for properly stopping PWM, before the provider gets > >> suspended: see [1]. Add the device link in: > >> - of_pwm_get() > >> - pwm_get() > >> - devm_*pwm_get() variants > >> as it requires a reference to the device for the PWM consumer. > >> > >> [1] https://lkml.org/lkml/2019/2/5/770 > >> > >> Suggested-by: Thierry Reding > >> Signed-off-by: Fabrice Gasnier > >> --- > >> Changes in v4: > >> - rework error handling following Thierry's comments > >> - turn/split pr_debug() into dev_err()/pr_warn(). > >> > >> Changes in v3: > >> - add struct device to of_get_pwm() arguments to handle device link from > >> there as discussed with Uwe. > >> --- > >> drivers/pwm/core.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- > >> include/linux/pwm.h | 6 ++++-- > >> 2 files changed, 51 insertions(+), 5 deletions(-) > >> > >> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c > >> index 1581f6a..64e10a6 100644 > >> --- a/drivers/pwm/core.c > >> +++ b/drivers/pwm/core.c > >> @@ -636,8 +636,35 @@ static struct pwm_chip *of_node_to_pwmchip(struct device_node *np) > >> return ERR_PTR(-EPROBE_DEFER); > >> } > >> > >> +static struct device_link *pwm_device_link_add(struct device *dev, > >> + struct pwm_device *pwm) > >> +{ > >> + struct device_link *dl; > >> + > >> + if (!dev) { > >> + /* > >> + * No device for the PWM consumer has been provided. It may > >> + * impact the PM sequence ordering: the PWM supplier may get > >> + * suspended before the consumer. > >> + */ > >> + pr_warn("no consumer dev, can't create device link to %s\n", > >> + dev_name(pwm->chip->dev)); > > > > Maybe use dev_warn(pwm->chip->dev, ...) ? > > Hi Uwe, > > I'm wondering a bit about this: In this case, the caller that doesn't > provide a struct device *, PWM provider isn't responsible for that. So I > just hope this wouldn't be miss-leading ? IMHO it's more the wording that might make the message misleading. If you use dev_warn(pwm->chip->dev, "No consumer device specified to create a device link to\n"); that's completely fine in my eyes. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |