lkml.org 
[lkml]   [2015]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/2] w1: slaves: w1_therm: Add temp attribute
    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@fries.net> PGP pub CB1EE8F0
    http://fries.net/~david/


    \
     
     \ /
      Last update: 2015-01-07 03:21    [W:2.863 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site