Re: Problem with new driver model?

From: Brian Gerst (bgerst@didntduck.org)
Date: Wed Jun 05 2002 - 16:00:44 EST


Patrick Mochel wrote:
>
> On 5 Jun 2002, Paul Fulghum wrote:
>
> > When testing the drivers I maintain on 2.5.20, I hit the
> > BUG_ON in include/linux/devices.txt:115.
>
> There is a patch that should fix this in Linus's tree.
>
> If you're using bitkeeper, you can pull it from
> linux.bkbits.net/linux-2.5.
>
> If not, it's appended here.
>
> -pat
>
> +void remove_driver(struct device_driver * drv)
> +{
> + spin_lock(&device_lock);
> + atomic_set(&drv->refcount,0);
> + spin_unlock(&device_lock);
> + __remove_driver(drv);
> +}
> +
> +/**
> + * put_driver - decrement driver's refcount and clean up if necessary
> + * @drv: driver in question
> + */
> +void put_driver(struct device_driver * drv)
> +{
> + if (!atomic_dec_and_lock(&drv->refcount,&device_lock))
> + return;
> + spin_unlock(&device_lock);
> +
> + __remove_driver(drv);
> +}

Shouldn't the calls to __remove_driver be done inside the device_lock?

--

Brian Gerst - 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/



This archive was generated by hypermail 2b29 : Fri Jun 07 2002 - 22:00:26 EST