lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 7 Oct 2014 10:28:17 +0200
From:	Thierry Reding <thierry.reding@...il.com>
To:	Stephen Warren <swarren@...dotorg.org>
Cc:	Bart Tanghe <bart.tanghe@...masmore.be>, matt.porter@...aro.org,
	linux-kernel@...r.kernel.org, linux-pwm@...r.kernel.org,
	linux-rpi-kernel@...ts.infradead.org
Subject: Re: [resend rfc v5]pwm: add BCM2835 PWM driver

On Mon, Oct 06, 2014 at 08:35:28PM -0700, Stephen Warren wrote:
> On 10/02/2014 04:41 AM, Bart Tanghe wrote:
> > Add pwm driver for Broadcom BCM2835 processor (Raspberry Pi)
> > 
> > Signed-off-by: Bart Tanghe <bart.tanghe@...masmore.be>
> > ---
> > Changes in v5:
> 
> By v5, I would drop "rfc" from the email subject.

And resend as well. Use resend only if you're resending without having
made any changes.

> > diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c
> 
> > +static int bcm2835_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
> > +{
> > +	struct bcm2835_pwm *pc = to_bcm2835_pwm(chip);
> > +	u32 value;
> > +
> > +	value = readl(pc->base);
> > +	value &= ~(PWM_CONTROL_MASK << PWM_CONTROL_STRIDE * pwm->pwm);
> > +	value |= (PWM_MODE << (PWM_CONTROL_STRIDE * pwm->pwm));
> > +	writel(value, pc->base);
> > +	return 0;
> > +}
> > +
> > +static void bcm2835_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
> > +{
> > +	struct bcm2835_pwm *pc = to_bcm2835_pwm(chip);
> > +	u32 value;
> > +
> > +	value = readl(pc->base)
> > +	value &= ~(PWM_CONTROL_MASK << PWM_CONTROL_STRIDE * pwm->pwm);
> > +	value &= (~DEFAULT << (PWM_CONTROL_STRIDE * pwm->pwm));
> 
> What is this second mask operation intended to do? The first mask
> operation already clears all the control bits, so clearing them again
> doesn't seem useful.

I suspend that you'll also want to use pwm->hwpwm instead of pwm->pwm.
pwm->hwpwm is the index of the PWM for the chip, whereas pwm->pwm is a
global index so the above breaks if another driver registered a PWM chip
before this driver.

Thierry

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists