public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: "Frantisek Rysanek" <Frantisek.Rysanek@post.cz>
To: linux-serial@vger.kernel.org
Subject: Re: Adding new driver - looking for suggestions
Date: Tue, 10 Jul 2007 23:35:02 +0200	[thread overview]
Message-ID: <469417A6.24982.128022FD@Frantisek.Rysanek.post.cz> (raw)

[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 1300 bytes --]

On 9 Jul 2007 at 19:37, Chris Doré wrote:
>
> A current patch can be found here:
> ftp://ftp.connecttech.com/pub/misc/bhbltnptm-2.6.21.patch
>
I'm just another by-stander, I don't have any vote, let me just
present my opinion...


+++ linux-2.6.21-cti/include/linux/serial_core.h2007-07-06
03:44:52.000000000 - 0400
@@ -274,6 +274,9 @@ struct uart_port {
unsigned
intline;/* port index */
unsigned longmapbase;/* for
ioremap */
struct
device*dev;/* parent device
*/
+intlmode;
+int(*lmode_fn)(struct
uart_port *port, int ioctl, unsigned int *value);
+int(*ptm_fn)(struct uart_port
*port, int ioctl, unsigned int *value);


As far as patching the vanilla kernel is concerned:
You seem to suggest an addition of rather proprietary data (members)
to the neatly generic struct uart_port. I'd suggest adding something
like

void* priv; // device-specific driver private data

to the generic struct uart_port of the vanilla kernel, which you
could then use to hook your own private data struct, regardless of
whether the rest of your driver lives in 8250_pci.c or in a stand-
alone module. This is the way it's done in a number of other generic
device structs (or maybe the more modern way is to use a nested
struct with "parent struct decoding").

Frank Rysanek


[-- Attachment #2: Mail message body --]
[-- Type: Application/Octet-stream, Size: 6262 bytes --]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
</head>
<body>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
On 9 Jul 2007 at 19:37, Chris Dor&#233; wrote:</span></font>
</div>
<div align="left">
<font face="Arial" color="#7f0000">
<span style=" font-size:10pt">
&gt; </span></font>
</div>
<div align="left">
<font face="Arial" color="#7f0000">
<span style=" font-size:10pt">
&gt; A current patch can be found here:</span></font>
<font face="Arial">
<span style=" font-size:10pt">
&#160;</span></font>
</div>
<div align="left">
<font face="Arial" color="#7f0000">
<span style=" font-size:10pt">
&gt; ftp://ftp.connecttech.com/pub/misc/bhbltnptm-2.6.21.patch</span></font>
<font face="Arial">
<span style=" font-size:10pt">
&#160;</span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
&gt; </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
I'm just another by-stander, I don't have any vote, let me just present my opinion... </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
<br />
</span>
</font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
<br />
</span>
</font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
+++ linux-2.6.21-cti/include/linux/serial_core.h&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;2007-07-06 03:44:52.000000000 - 
0400 </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
@@ -274,6 +274,9 @@ struct uart_port { </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;unsigned int&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;line;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;/* 
port index */ </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;unsigned long&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;mapbase;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;/* for ioremap */ </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;struct device&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;*dev;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;/* parent 
device */ </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;lmode; </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;(*lmode_fn)(struct uart_port *port, int ioctl, unsigned int *value); </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;(*ptm_fn)(struct uart_port *port, int ioctl, unsigned int *value); </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
<br />
</span>
</font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
<br />
</span>
</font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
As far as patching the vanilla kernel is concerned: </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
You seem to suggest an addition of rather proprietary data (members) to the neatly generic </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
struct uart_port. I'd suggest adding something like </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
<br />
</span>
</font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;void* priv;&#160; // device-specific driver private data </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
<br />
</span>
</font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
to the generic struct uart_port of the vanilla kernel, which you could then use to hook your 
own private data struct, regardless of whether the rest of your driver lives in 8250_pci.c or in 
a stand-alone module. This is the way it's done in a number of other generic device structs. </span></font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
<br />
</span>
</font>
</div>
<div align="left">
<font face="Arial">
<span style=" font-size:10pt">
Frank Rysanek </span></font>
</div>
<div align="left">
&nbsp;</div>
</body>
</html>

Attachments:
  C:\DOCUME~1\Fanouch\LOCALS~1\Temp\WPM$252E.PM$

             reply	other threads:[~2007-07-10 21:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10 21:35 Frantisek Rysanek [this message]
2007-07-11 14:20 ` Adding new driver - looking for suggestions Chris Doré
  -- strict thread matches above, loose matches on Subject: below --
2007-07-09 17:37 Chris Doré

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=469417A6.24982.128022FD@Frantisek.Rysanek.post.cz \
    --to=frantisek.rysanek@post.cz \
    --cc=linux-serial@vger.kernel.org \
    /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