Re: [PATCH 2/2] w1: slaves: w1_therm: Add temp attribute

From: David Fries
Date: Tue Jan 06 2015 - 21:09:04 EST


On Tue, Jan 06, 2015 at 03:29:56PM +0100, Mariusz Gorski wrote:
> Add new attribute to simplify reading of current temperature.

> +static ssize_t temp_show(struct device *device,
> + struct device_attribute *attr, char *buf)
> +{
> + struct w1_slave *sl = dev_to_w1_slave(device);
> + struct w1_master *dev = sl->master;
> + u8 rom[9], verdict;
> + int temp;
> +
> + if (mutex_lock_interruptible(&dev->bus_mutex))
> + return -EINTR;
> +
> + memset(rom, 0, sizeof(rom));
> +
> + verdict = read_rom(device, rom);
> +
> + if (verdict < 0)
> + return verdict;

I wanted to point out that this returns without unlocking bus_mutex.

--
David Fries <david@xxxxxxxxx> PGP pub CB1EE8F0
http://fries.net/~david/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/