Re: [PATCH][ATM] add reference counting to atm_dev

Greg KH (greg@kroah.com)
Wed, 14 May 2003 13:59:49 -0700


On Wed, May 14, 2003 at 04:20:09PM -0400, chas williams wrote:
> this patch adds a reference count to atm_dev, and a lock to
> protect the members of struct atm_dev. atm_dev_lock is now
> used to protect the atm_dev linked list. atm_find_dev was
> renamed to atm_dev_lookup. atm_dev_hold and atm_dev_release
> were added to manipulate atm_dev's reference count. this
> fixes atm_ioctl()'s troublesome 'global' spinlock. also,
> got rid of the nodev list of 'unlinked' vccs.
>
>
> --- linux-2.5.68/include/linux/atmdev.h.004 Fri May 9 08:30:20 2003
> +++ linux-2.5.68/include/linux/atmdev.h Wed May 14 12:40:39 2003
> @@ -331,6 +331,8 @@
> struct k_atm_dev_stats stats; /* statistics */
> char signal; /* signal status (ATM_PHY_SIG_*) */
> int link_rate; /* link rate (default: OC3) */
> + atomic_t refcnt; /* reference count */

Any reason to not just use a struct device here? This is a device,
right? Or at the very least, a kobject would be acceptable.

Please don't roll your own reference counting code, when we've already
gotten a in-kernel version that has been debugged quite well.

Is this going to help us be able to get rid of the MOD_* calls in ATM
drivers soon?

thanks,

greg k-h
-
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/