From: Greg KH <greg@kroah.com>
To: Germano Barreiro <germano.barreiro@cyclades.com>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org,
Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
Wanda Rosalino <wanda.rosalino@cyclades.com>
Subject: Re: patch for sysfs in the cyclades driver
Date: Fri, 29 Oct 2004 21:40:56 -0700 [thread overview]
Message-ID: <20041030044056.GB1907@kroah.com> (raw)
In-Reply-To: <1098989790.6605.3.camel@germano.cyclades.com>
On Thu, Oct 28, 2004 at 04:56:30PM -0200, Germano Barreiro wrote:
> Hi
>
> This patch implements the sysfs support in the cyclades async driver,
> which is needed by the Cyclades' CyMonitor application. It is based in
> the last one sent (see copied message below), but implements the changes
> asked for that patch by Greg (the array of attributes was eliminated and
> now there is only one file for each value to be exported).
> I hope it is ok to be applied now, but if more changes are needed I
> would be pleased to listen about them. By the way, I'm grateful to
> Marcelo for taking time to examining many "middle" versions of this
> patch, and also to Greg for his comments to the last patch.
Close, it's getting better, but you still have a ways to go...
> --- linux-2.6.10rc1.orig/drivers/char/cyclades.c 2004-10-25 16:40:00.000000000 -0200
> +++ linux-2.6.10rc1/drivers/char/cyclades.c 2004-10-26 17:13:20.000000000 -0200
> @@ -646,6 +646,7 @@ static char rcsid[] =
> #include <linux/string.h>
> #include <linux/fcntl.h>
> #include <linux/ptrace.h>
> +#include <linux/device.h>
> #include <linux/cyclades.h>
> #include <linux/mm.h>
> #include <linux/ioport.h>
> @@ -700,8 +701,36 @@ static void cy_send_xchar (struct tty_st
>
> #define JIFFIES_DIFF(n, j) ((j) - (n))
>
> +static char _version[150];
> static struct tty_driver *cy_serial_driver;
>
> +
> +const static char sysufixes[18][10]={"stat","card","baud","flow","rxfl","txfl","dcd","dsr","cts",
> + "rts","dtr","rx","tx","bdrx","bdtx","par","stop","chlen"};
Ick, this isn't needed.
> +ssize_t (*showfunctions[])(struct device *, char *)={
> + show_sys_stat,
> + show_sys_card,
> + show_sys_baud,
> + show_sys_flow,
> + show_sys_rxfl,
> + show_sys_txfl,
> + show_sys_dcd,
> + show_sys_dsr,
> + show_sys_cts,
> + show_sys_rts,
> + show_sys_dtr,
> + show_sys_rx,
> + show_sys_tx,
> + show_sys_bdrx,
> + show_sys_bdtx,
> + show_sys_par,
> + show_sys_stop,
> + show_sys_chlen
> +};
Why not just do as the i2c chip drivers do? Use a macro for your
show functions, it's much simpler.
> + switch(whatinfo){
> +
> + case STAT: //open/closed
Break this big switch statement up into the individual show functions.
Hm, ok, you can't use a macro for them then, sorry. But it should be
simpler.
> + if ( tty == 0 )
> + len = sprintf(buf, "%s:%s\n", cysys_state, cysys_close);
> + else
> + len = sprintf(buf, "%s:%s\n", cysys_state, cysys_open);
No, don't put the %s: stuff in there. The user read from the "stat"
file. They know what the value should be, you don't have to remind them
again :)
thanks,
greg k-h
next prev parent reply other threads:[~2004-10-30 16:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-28 18:56 patch for sysfs in the cyclades driver Germano Barreiro
2004-10-30 4:40 ` Greg KH [this message]
2004-11-01 17:01 ` germano.barreiro
[not found] <71A17D6448EC0140B44BCEB8CD0DA36E04B9D812@minimail.digi.com>
2004-11-03 2:28 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2004-11-03 13:09 Germano
2004-11-04 10:25 ` Marcelo Tosatti
2004-11-04 16:58 ` Roland Dreier
2004-11-04 14:29 ` Marcelo Tosatti
2004-11-04 17:40 ` Roland Dreier
2004-11-04 17:44 ` Greg KH
2004-11-04 17:42 ` Greg KH
2004-11-04 17:40 ` Greg KH
2004-11-04 19:05 ` Roland Dreier
2004-11-04 19:17 ` Greg KH
2004-11-03 19:55 Kilau, Scott
2004-11-03 20:03 ` Greg KH
2004-11-03 20:20 Kilau, Scott
2004-11-03 21:23 ` Greg KH
2004-11-03 22:35 Kilau, Scott
2004-11-03 23:08 ` Greg KH
2004-11-04 16:40 Kilau, Scott
2004-11-04 17:39 ` Greg KH
2004-11-04 17:50 Kilau, Scott
2004-11-04 18:28 ` Germano
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=20041030044056.GB1907@kroah.com \
--to=greg@kroah.com \
--cc=germano.barreiro@cyclades.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=torvalds@osdl.org \
--cc=wanda.rosalino@cyclades.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.