linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Enrico Weigelt, metux IT consult" <lkml@metux.net>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Morris Ku <saumah@gmail.com>, gregkh <gregkh@linuxfoundation.org>,
	morris_ku@sunix.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Respond:add support for SUNIX Multi-I/O board
Date: Fri, 22 Mar 2019 19:26:46 +0100	[thread overview]
Message-ID: <a2758c4b-ac49-e731-46b0-6990c3534da7@metux.net> (raw)
In-Reply-To: <CAK8P3a1TkKtG3E3U0xxpJrf=qph0dkn27Apd99EaHMAPOfPtpw@mail.gmail.com>

On 21.03.19 09:53, Arnd Bergmann wrote:

> I think serial port drivers typically have a limit on the number of
> ports, so we likely need the same here. 

Except for earlycon (haven't had a closer look at it yet), I don't see
any hard reason for that (maybe Greg could give us more insight here).
I seriously doubt that these boards could be relevant for earlycon.
(hard to find a machine that needs serial earlycon while not having some
uart on-board ;-))

> However the number of boards should not be limited in the mfd driver
> that just exports the serial ports to the serial driver.

Exactly. And there should be any global arrays for these boards, where
every access runs through. Or even worse: looping through it, to find
the right entry, within ISRs.

>>> +> +static int snx_ser_port_total_cnt;
>>> +> +static int snx_par_port_total_cnt;
>>> +> +
>>> +> +int snx_board_count;
>>> +> +
>>> +> +static struct snx_ser_driver sunix_ser_reg = {
>>> +> +     .dev_name = "ttySNX",
>>> +> +     .major = 0,
>>> +> +     .minor = 0,
>>> +> +     .nr = (SNX_SER_TOTAL_MAX + 1),
>>> +> +};
>>> +
>>> +can't this be const ?
>>> +
>>> i prefer keep it in current format.
>>
>> Why ? do you ever have to write into this struct ?
> 
> I think this will just go away after the rewrite into a proper
> layered driver, so it doesn't matter.

That's exactly the point, which I've been repeating over and over again.

By the way, one more weird thing that slipped trough my previous
reviews: he's redefining standard structs and typecasting them.
Actually, he copy+paste'd large parts of the serial and parport
subsystems.

> The best way I can think of to do this would be to have a nested
> irqchip in the mfd driver that handles the per-board interrupt and
> provides a unique irq number to the individual port drivers.
> This makes a very simple irq handler in the port driver, and keeps
> the multiplexing where it belongs.

Exactly. That's the way it works w/ lot's of other composite devices.
(I recall some exotic daq cards that work similar way)

@Morris: please try to find a fitting generic, configurable irqchip
driver first. If you don't find one, talk to us and give us a detailed
explaination how that part of your cards actually works, so we could
write some generic driver. I might have some customer specific devices
that could also benefit from that.

--mtx

-- 
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287

  reply	other threads:[~2019-03-22 18:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15 10:06 [PATCH] Respond:add support for SUNIX Multi-I/O board Morris Ku
2019-03-20 18:24 ` Enrico Weigelt, metux IT consult
2019-03-21  8:53   ` Arnd Bergmann
2019-03-22 18:26     ` Enrico Weigelt, metux IT consult [this message]
2019-03-15 10:10 Morris Ku
2019-03-27 16:38 ` Greg KH

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=a2758c4b-ac49-e731-46b0-6990c3534da7@metux.net \
    --to=lkml@metux.net \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=morris_ku@sunix.com \
    --cc=saumah@gmail.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).