Re: [patch 13/13] s390: dasd device identifiers.

From: Andrew Morton
Date: Mon Apr 24 2006 - 19:46:28 EST


Martin Schwidefsky <schwidefsky@xxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/