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  linux-cve-announce  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:	Mon, 12 Aug 2013 10:27:03 -0700
From:	"Mark A. Greer" <mgreer@...malcreek.com>
To:	Anton Vorontsov <anton@...msg.org>
Cc:	David Woodhouse <dwmw2@...radead.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bq24190_charger: Add support for TI BQ24190 Battery
 Charger

On Fri, Aug 09, 2013 at 12:21:11PM -0700, Anton Vorontsov wrote:
> On Wed, Aug 07, 2013 at 02:56:48PM -0700, Mark A. Greer wrote:

> ...
> > +static irqreturn_t bq24190_irq_handler_thread(int irq, void *data)
> > +{
> > +	struct bq24190_dev_info *bdi = data;
> > +	bool alert_userspace = false;
> > +	u8 ss_reg, f_reg;
> > +	int ret;
> > +	static bool first_time = true;
> ...
> > +	/*
> > +	 * Sometimes bq24190 gives a steady trickle of interrupts even
> > +	 * though the watchdog timer is turned off and neither the STATUS
> > +	 * nor FAULT registers have changed.  Weed out these sprurious
> > +	 * interrupts so userspace isn't alerted for no reason.
> > +	 * In addition, the chip always generates an interrupt after
> > +	 * register reset so we should ignore that one (the very first
> > +	 * interrupt received).
> > +	 */
> > +	if (alert_userspace && !first_time) {
> 
> Hm, global static... I would guess that per-device flag would be more
> appropriate, just in case if there are multiple chargers?

Oops.

> ...
> > +	do {
> > +		ret = bq24190_read_mask(bdi, BQ24190_REG_POC,
> > +				BQ24190_REG_POC_RESET_MASK,
> > +				BQ24190_REG_POC_RESET_SHIFT,
> > +				&v);
> > +		if ((ret <= 0) || !v)
> > +			break;
> > +
> > +		udelay(10);
> > +	} while (--limit);
> > +
> > +	if (!ret && limit)
> > +		ret = bq24190_set_mode_host(bdi);
> > +out:
> > +	pm_runtime_put_sync(bdi->dev);
> > +	return ret;
> > +}
> > +
> > +#define irq_to_gpio(irq)	((irq) - gpio_to_irq(0))
> 
> Ugh... this does not seem right. On a particular platform it might work,
> but not in general...

Umm, yeah.  Plain laziness on my part.

> p.s. I am also not a big fan of unnecessary 'out:' goto labels... most of
> them might be changed to just 'return ...;'

OK.

Mark
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ