lkml.org 
[lkml]   [2006]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 13/13] s390: dasd device identifiers.
Martin Schwidefsky <schwidefsky@de.ibm.com> wrote:
>
> @@ -45,6 +45,7 @@ struct dasd_devmap {
> unsigned int devindex;
> unsigned short features;
> struct dasd_device *device;
> + struct dasd_uid uid;
> };

Someone's missing a TAB key.

> +static ssize_t
> +dasd_alias_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> + struct dasd_devmap *devmap;
> + int alias;
> +
> + devmap = dasd_find_busid(dev->bus_id);
> + spin_lock(&dasd_devmap_lock);
> + if (!IS_ERR(devmap))
> + alias = devmap->uid.alias;
> + else
> + alias = 0;
> + spin_unlock(&dasd_devmap_lock);
> +
> + return sprintf(buf, alias ? "1\n" : "0\n");
> +}

The locking is suspicious. We take a spinlock just for a single read?

> +/*
> + * Return copy of the device unique identifier.
> + */
> +int
> +dasd_get_uid(struct ccw_device *cdev, struct dasd_uid *uid)
> +{
> + struct dasd_devmap *devmap;
> +
> + devmap = dasd_find_busid(cdev->dev.bus_id);
> + if (IS_ERR(devmap))
> + return PTR_ERR(devmap);
> + spin_lock(&dasd_devmap_lock);
> + *uid = devmap->uid;
> + spin_unlock(&dasd_devmap_lock);
> + return 0;
> +}

And for a single write?


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

\
 
 \ /
  Last update: 2006-04-25 01:49    [W:0.090 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site