From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH 1/4] gpio: mvebu: Add limited PWM support Date: Sat, 18 Mar 2017 16:37:53 +0100 Message-ID: <20170318153753.GA22088@lunn.ch> References: <20170316064218.9169-1-ralph.sennhauser@gmail.com> <20170316064218.9169-2-ralph.sennhauser@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-pwm-owner@vger.kernel.org To: Linus Walleij Cc: Ralph Sennhauser , "linux-gpio@vger.kernel.org" , Imre Kaloz , Thierry Reding , Alexandre Courbot , Rob Herring , Mark Rutland , Greg Kroah-Hartman , "David S. Miller" , Geert Uytterhoeven , Mauro Carvalho Chehab , Andrew Morton , Guenter Roeck , "open list:PWM SUBSYSTEM" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list List-Id: linux-gpio@vger.kernel.org > > +static void mvebu_pwm_free(struct pwm_chip *chip, struct pwm_device *pwmd) > > +{ > > + struct mvebu_pwm *pwm = to_mvebu_pwm(chip); > > + struct gpio_desc *desc = gpio_to_desc(pwmd->pwm); > > + unsigned long flags; > > + > > + spin_lock_irqsave(&pwm->lock, flags); > > + gpiod_free(desc); > > + pwm->used = false; > > + spin_unlock_irqrestore(&pwm->lock, flags); > > +} > > No need to set the output value to zero or something here? > And turn off blinking? Or is that done some other way? Hi Linus The disable op will turn of blinking. I've not checked, but i assume the PWM core will not allow you to free an enabled PWM? > I think both of these need to be tagged __maybe_unused to not give > noise in randconfig builds. I've not seen any 0-day patch emails giving warnings. So i suspect it is O.K. Andrew From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751583AbdCRPjQ (ORCPT ); Sat, 18 Mar 2017 11:39:16 -0400 Received: from vps0.lunn.ch ([178.209.37.122]:52627 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751025AbdCRPjD (ORCPT ); Sat, 18 Mar 2017 11:39:03 -0400 Date: Sat, 18 Mar 2017 16:37:53 +0100 From: Andrew Lunn To: Linus Walleij Cc: Ralph Sennhauser , "linux-gpio@vger.kernel.org" , Imre Kaloz , Thierry Reding , Alexandre Courbot , Rob Herring , Mark Rutland , Greg Kroah-Hartman , "David S. Miller" , Geert Uytterhoeven , Mauro Carvalho Chehab , Andrew Morton , Guenter Roeck , "open list:PWM SUBSYSTEM" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list Subject: Re: [PATCH 1/4] gpio: mvebu: Add limited PWM support Message-ID: <20170318153753.GA22088@lunn.ch> References: <20170316064218.9169-1-ralph.sennhauser@gmail.com> <20170316064218.9169-2-ralph.sennhauser@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > +static void mvebu_pwm_free(struct pwm_chip *chip, struct pwm_device *pwmd) > > +{ > > + struct mvebu_pwm *pwm = to_mvebu_pwm(chip); > > + struct gpio_desc *desc = gpio_to_desc(pwmd->pwm); > > + unsigned long flags; > > + > > + spin_lock_irqsave(&pwm->lock, flags); > > + gpiod_free(desc); > > + pwm->used = false; > > + spin_unlock_irqrestore(&pwm->lock, flags); > > +} > > No need to set the output value to zero or something here? > And turn off blinking? Or is that done some other way? Hi Linus The disable op will turn of blinking. I've not checked, but i assume the PWM core will not allow you to free an enabled PWM? > I think both of these need to be tagged __maybe_unused to not give > noise in randconfig builds. I've not seen any 0-day patch emails giving warnings. So i suspect it is O.K. Andrew