lkml.org 
[lkml]   [2010]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it


\
 
 \ /
  Last update: 2010-02-21 20:23    [W:0.083 / U:0.956 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site