Message ID | 1278578095-25324-2-git-send-email-karl@hiramoto.org |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
From: Karl Hiramoto <karl@hiramoto.org> Date: Thu, 8 Jul 2010 10:34:47 +0200 > + > +/* > + * atm_dev_signal_change > + * > + * Propagate lower layer signal change in atm_dev->signal to netdevice. > + * The event will be sent via a notifier call chain. > + */ I said to format comments: /* Like * this. */ not: /* * Like * this. */ Honestly, I don't know how I can be more clear about this :-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 07/09/2010 06:47 AM, David Miller wrote: > From: Karl Hiramoto <karl@hiramoto.org> > Date: Thu, 8 Jul 2010 10:34:47 +0200 > >> + >> +/* >> + * atm_dev_signal_change >> + * >> + * Propagate lower layer signal change in atm_dev->signal to netdevice. >> + * The event will be sent via a notifier call chain. >> + */ > I said to format comments: > > /* Like > * this. > */ > > not: > > /* > * Like > * this. > */ > > Honestly, I don't know how I can be more clear about this :-) Ok, fixing it, but there are 100's of occurences in net/ like i had it. :-) -- Karl -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Karl Hiramoto <karl@hiramoto.org> Date: Fri, 09 Jul 2010 08:36:03 +0200 > Ok, fixing it, but there are 100's of occurences in net/ like i had it. :-) I would be happy to see a patch which fixes them up :-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Jul 08, 2010 at 11:38:01PM -0700, David Miller wrote: > From: Karl Hiramoto <karl@hiramoto.org> > Date: Fri, 09 Jul 2010 08:36:03 +0200 > > > Ok, fixing it, but there are 100's of occurences in net/ like i had it. :-) > > I would be happy to see a patch which fixes them up :-) Really? By my calculations it would be an awful lot of churn. $ find net/ -type f -name "*.[chS]" | xargs grep "\/\* *$" | wc -l 6833 $ find net/ -type f -name "*.[chS]" | xargs grep -l "\/\* *$" | wc -l 929 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Simon Horman <horms@verge.net.au> Date: Fri, 9 Jul 2010 15:50:13 +0900 > On Thu, Jul 08, 2010 at 11:38:01PM -0700, David Miller wrote: >> From: Karl Hiramoto <karl@hiramoto.org> >> Date: Fri, 09 Jul 2010 08:36:03 +0200 >> >> > Ok, fixing it, but there are 100's of occurences in net/ like i had it. :-) >> >> I would be happy to see a patch which fixes them up :-) > > Really? By my calculations it would be an awful lot of churn. > > $ find net/ -type f -name "*.[chS]" | xargs grep "\/\* *$" | wc -l > 6833 > $ find net/ -type f -name "*.[chS]" | xargs grep -l "\/\* *$" | wc -l > 929 I didn't mean "one patch" which fixes them up :) Done graudually in chunks over a period of time, it's not likely to be so much churn. This is how every other coding style malfeasance gets handled. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Jul 08, 2010 at 11:53:14PM -0700, David Miller wrote: > From: Simon Horman <horms@verge.net.au> > Date: Fri, 9 Jul 2010 15:50:13 +0900 > > > On Thu, Jul 08, 2010 at 11:38:01PM -0700, David Miller wrote: > >> From: Karl Hiramoto <karl@hiramoto.org> > >> Date: Fri, 09 Jul 2010 08:36:03 +0200 > >> > >> > Ok, fixing it, but there are 100's of occurences in net/ like i had it. :-) > >> > >> I would be happy to see a patch which fixes them up :-) > > > > Really? By my calculations it would be an awful lot of churn. > > > > $ find net/ -type f -name "*.[chS]" | xargs grep "\/\* *$" | wc -l > > 6833 > > $ find net/ -type f -name "*.[chS]" | xargs grep -l "\/\* *$" | wc -l > > 929 > > I didn't mean "one patch" which fixes them up :) > > Done graudually in chunks over a period of time, it's not likely > to be so much churn. > > This is how every other coding style malfeasance gets handled. Understood -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 08 Jul 2010 21:47:45 -0700 (PDT) David Miller <davem@davemloft.net> wrote: > From: Karl Hiramoto <karl@hiramoto.org> > Date: Thu, 8 Jul 2010 10:34:47 +0200 > > /* Like > * this. > */ > > not: > > /* > * Like > * this. > */ > > Honestly, I don't know how I can be more clear about this :-) this is somewhat contrary to the suggested multi-line format given in Documentation/CodingStyle: The preferred style for long (multi-line) comments is: /* * This is the preferred style for multi-line * comments in the Linux kernel source code. * Please use it consistently. * * Description: A column of asterisks on the left side, * with beginning and ending almost-blank lines. */ -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Jul 09, 2010 at 07:16:10AM -0400, chas williams - CONTRACTOR wrote: > On Thu, 08 Jul 2010 21:47:45 -0700 (PDT) > David Miller <davem@davemloft.net> wrote: > > > From: Karl Hiramoto <karl@hiramoto.org> > > Date: Thu, 8 Jul 2010 10:34:47 +0200 > > > > /* Like > > * this. > > */ > > > > not: > > > > /* > > * Like > > * this. > > */ > > > > Honestly, I don't know how I can be more clear about this :-) > > this is somewhat contrary to the suggested multi-line format given in > Documentation/CodingStyle: > > > The preferred style for long (multi-line) comments is: > > /* > * This is the preferred style for multi-line > * comments in the Linux kernel source code. > * Please use it consistently. > * > * Description: A column of asterisks on the left side, > * with beginning and ending almost-blank lines. > */ This is a topic that seems to come up every now and again. I think that the reality of the situation is that there are several acceptable styles and some maintainers prefer one over the other, some more strongly than others. So I think that documentation is slightly misleading though it is certainly true for many maintainers. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil> Date: Fri, 9 Jul 2010 07:16:10 -0400 > The preferred style for long (multi-line) comments is: Which is stupid because it causes one to be able to keep less actual code on the screen at a time. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, 09 Jul 2010 09:48:56 -0700 (PDT) David Miller <davem@davemloft.net> wrote: > Which is stupid because it causes one to be able to keep less actual > code on the screen at a time. stupid or not it is preferred. get it changed. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index 817b237..649dd24 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h @@ -431,6 +431,15 @@ struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops, int number,unsigned long *flags); /* number == -1: pick first available */ struct atm_dev *atm_dev_lookup(int number); void atm_dev_deregister(struct atm_dev *dev); + +/* + * atm_dev_signal_change + * + * Propagate lower layer signal change in atm_dev->signal to netdevice. + * The event will be sent via a notifier call chain. + */ +void atm_dev_signal_change(struct atm_dev *dev, char signal); + void vcc_insert_socket(struct sock *sk); @@ -510,6 +519,17 @@ void register_atm_ioctl(struct atm_ioctl *); */ void deregister_atm_ioctl(struct atm_ioctl *); + + +/* + * register_atmdevice_notifier - register atm_dev notify events + * + * Clients like br2684 will register notify events + * Currently we notify of signal found/lost + */ +int register_atmdevice_notifier(struct notifier_block *nb); +void unregister_atmdevice_notifier(struct notifier_block *nb); + #endif /* __KERNEL__ */ #endif diff --git a/net/atm/common.c b/net/atm/common.c index b43feb1..940404a 100644 --- a/net/atm/common.c +++ b/net/atm/common.c @@ -37,6 +37,8 @@ EXPORT_SYMBOL(vcc_hash); DEFINE_RWLOCK(vcc_sklist_lock); EXPORT_SYMBOL(vcc_sklist_lock); +static ATOMIC_NOTIFIER_HEAD(atm_dev_notify_chain); + static void __vcc_insert_socket(struct sock *sk) { struct atm_vcc *vcc = atm_sk(sk); @@ -212,6 +214,22 @@ void vcc_release_async(struct atm_vcc *vcc, int reply) } EXPORT_SYMBOL(vcc_release_async); +void atm_dev_signal_change(struct atm_dev *dev, char signal) +{ + pr_debug("%s signal=%d dev=%p number=%d dev->signal=%d\n", + __func__, signal, dev, dev->number, dev->signal); + + /* atm driver sending invalid signal */ + WARN_ON(signal < ATM_PHY_SIG_LOST || signal > ATM_PHY_SIG_FOUND); + + if (dev->signal == signal) + return; /* no change */ + + dev->signal = signal; + + atomic_notifier_call_chain(&atm_dev_notify_chain, signal, dev); +} +EXPORT_SYMBOL(atm_dev_signal_change); void atm_dev_release_vccs(struct atm_dev *dev) { @@ -781,6 +799,18 @@ int vcc_getsockopt(struct socket *sock, int level, int optname, return vcc->dev->ops->getsockopt(vcc, level, optname, optval, len); } +int register_atmdevice_notifier(struct notifier_block *nb) +{ + return atomic_notifier_chain_register(&atm_dev_notify_chain, nb); +} +EXPORT_SYMBOL_GPL(register_atmdevice_notifier); + +void unregister_atmdevice_notifier(struct notifier_block *nb) +{ + atomic_notifier_chain_unregister(&atm_dev_notify_chain, nb); +} +EXPORT_SYMBOL_GPL(unregister_atmdevice_notifier); + static int __init atm_init(void) { int error;
Add notifier chain for changes in atm_dev. Clients like br2684 will call register_atmdevice_notifier() to be notified of changes. Drivers will call atm_dev_signal_change() to notify clients like br2684 of the change. On DSL and ATM devices it's usefull to have a know if you have a carrier signal. netdevice LOWER_UP changes can be propagated to userspace via netlink monitor. Signed-off-by: Karl Hiramoto <karl@hiramoto.org> --- include/linux/atmdev.h | 20 ++++++++++++++++++++ net/atm/common.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 0 deletions(-)