[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20100221192101.GF21778@enneenne.com>
Date: Sun, 21 Feb 2010 20:21:01 +0100
From: Rodolfo Giometti <giometti@...eenne.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org,
David Woodhouse <dwmw2@...radead.org>,
Dave Jones <davej@...hat.com>, Sam Ravnborg <sam@...nborg.org>,
Greg KH <greg@...ah.com>,
Randy Dunlap <randy.dunlap@...cle.com>,
Kay Sievers <kay.sievers@...y.org>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Michael Kerrisk <mtk.manpages@...il.com>,
Christoph Hellwig <hch@...radead.org>,
Alexander Gordeev <lasaine@....cs.msu.su>
Subject: Re: [PATCH 6/8] pps: serial clients support.
On Fri, Feb 19, 2010 at 01:53:59PM -0800, Andrew Morton wrote:
>
> hm. The n_tty_open/close layering is a bit grubby but I guess we don't
> have a need to create anything more comprehensive at this stage.
>
> A small stylistic thing: the code's a bit confusing at present because
> the names n_tty_open/n_tty_close are identical to the global functions
> over in n_tty.c. A user of ctags will be tricked. Also, the _way_ in
> which these function pointers are called:
>
> ret = n_tty_open(tty);
>
> make it look like the code is calling
> drivers/char/n_tty.c:n_tty_open(). Except it isn't.
>
> So I think it's better to do it with
>
> ret = (*n_tty_open)(tty);
>
> to avoid misleading the reader.
>
> And perhaps to rename these variables to avoid the duplication with the
> global functions.
It could be acceptable using functions
alias_n_tty_open()/alias_n_tty_close() modifying the code as follow?
diff --git a/drivers/pps/clients/pps-ldisc.c
b/drivers/pps/clients/pps-ldisc.c
index 59e6301..15c4622 100644
--- a/drivers/pps/clients/pps-ldisc.c
+++ b/drivers/pps/clients/pps-ldisc.c
@@ -53,7 +53,7 @@ static void pps_tty_dcd_change(struct tty_struct
*tty, unsigne
status ? "assert" : "clear", jiffies, id);
}
-static int (*n_tty_open)(struct tty_struct *tty);
+static int (*alias_n_tty_open)(struct tty_struct *tty);
static int pps_tty_open(struct tty_struct *tty)
{
@@ -79,7 +79,7 @@ static int pps_tty_open(struct tty_struct *tty)
tty->disc_data = (void *) ret;
/* Should open N_TTY ldisc too */
- ret = n_tty_open(tty);
+ ret = alias_n_tty_open(tty);
if (ret < 0)
pps_unregister_source((int) tty->disc_data);
@@ -88,14 +88,14 @@ static int pps_tty_open(struct tty_struct *tty)
return 0;
}
-static void (*n_tty_close)(struct tty_struct *tty);
+static void (*alias_n_tty_close)(struct tty_struct *tty);
static void pps_tty_close(struct tty_struct *tty)
{
int id = (int) tty->disc_data;
pps_unregister_source(id);
- n_tty_close(tty);
+ alias_n_tty_close(tty);
pr_info("PPS source #%d removed\n", id);
}
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@...eenne.com
Linux Device Driver giometti@...ux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists