netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: remi.denis-courmont@nokia.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net] Phonet: hold GPRS device while cleaning up
Date: Mon, 08 Dec 2008 02:21:53 -0800 (PST)	[thread overview]
Message-ID: <20081208.022153.93642210.davem@davemloft.net> (raw)
In-Reply-To: <1228730965-19087-1-git-send-email-remi.denis-courmont@nokia.com>

From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Date: Mon,  8 Dec 2008 12:09:25 +0200

This is just a side-comment about the phonet stack, not directly
related to this patch.

> diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c
> index 9978afb..9602bfc 100644
> --- a/net/phonet/pep-gprs.c
> +++ b/net/phonet/pep-gprs.c
> @@ -340,8 +340,10 @@ void gprs_detach(struct sock *sk)
>  	release_sock(sk);
>  
>  	printk(KERN_DEBUG"%s: detached\n", net->name);
> +	dev_hold(net); /* TX work still needs it */
>  	unregister_netdev(net);
>  	flush_scheduled_work();
> +	dev_put(net);
>  	sock_put(sk);
>  	skb_queue_purge(&dev->tx_queue);
>  }

Can we get the phonet stack using more sensible local
variable names for netdev pointers?

We have network namespace objects, and everything says
"net" as the variable name to hold pointers to such
objects.

Using the same local variable name for "struct netdev"
pointers breeds confusion and makes phonet patches and
code difficult to read for people familiar with the
rest of the Linux networking.

Since you use "dev", which is the typical way to name
netdev pointers in networking code, for the phonet et al.
private stuff, one thing you can do is adopt the technique
I usually use:

1) Driver/subsystem private objects get a two letter local
   variable name, the second letter is 'p' for pointer.
   So a TG3 driver private pointer variable is "tp".  You'll
   see this in pretty much every single driver I ever wrote.

2) struct netdev pointer variables are "dev"

3) Network namespace pointer variables are "net"

With this we'll achieve consistency and much easier to read
and validate patches.

Just a suggestion :)

  reply	other threads:[~2008-12-08 10:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-08 10:09 [PATCH net] Phonet: hold GPRS device while cleaning up Rémi Denis-Courmont
2008-12-08 10:21 ` David Miller [this message]
2008-12-08 11:03   ` Rémi Denis-Courmont
2008-12-08 11:45     ` David Miller
2008-12-09  7:45       ` [PATCH] Phonet: improve GPRS variable names Rémi Denis-Courmont
2008-12-09  7:51         ` Rémi Denis-Courmont
2008-12-09  8:05           ` David Miller
2008-12-09 23:29         ` David Miller
2008-12-10 13:14           ` Rémi Denis-Courmont
2008-12-10 13:15             ` [PATCH net] Phonet: ensure GPRS device does not go away during TX work Rémi Denis-Courmont
2008-12-10 23:28               ` David Miller
2008-12-11  8:11                 ` Rémi Denis-Courmont
2008-12-11  8:33                   ` David Miller
2008-12-11 14:04                     ` [PATCH net-2.6] Phonet: keep TX queue disabled when the device is off Rémi Denis-Courmont
2008-12-15  8:54                       ` David Miller
2008-12-10 13:15             ` [PATCH net-next] Phonet: improve GPRS variable names Rémi Denis-Courmont
2008-12-09  8:15 ` [PATCH net] Phonet: hold GPRS device while cleaning up David Miller
2008-12-09 15:03   ` Rémi Denis-Courmont
2008-12-09 23:28     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081208.022153.93642210.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=remi.denis-courmont@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).