* [PATCH] tty: serial: 8250: Fixes: Fix port count mismatch with the device
@ 2024-06-14 9:03 Crescent Hsieh
2024-06-14 9:07 ` Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: Crescent Hsieh @ 2024-06-14 9:03 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko
Cc: linux-kernel, linux-serial, Crescent Hsieh
Normally, the number of ports is indicated by the third digit of the
device ID on Moxa PCI serial boards. For example, `0x1121` indicates a
device with 2 ports.
However, `CP116E_A_A` and `CP116E_A_B` are exceptions; they have 8
ports, but the third digit of the device ID is `6`.
This patch introduces a function to retrieve the number of ports on Moxa
PCI serial boards, addressing the issue described above.
Signed-off-by: Crescent Hsieh <crescentcy.hsieh@moxa.com>
---
drivers/tty/serial/8250/8250_pci.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 40af74b55933..e1d7aa2fa347 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1985,6 +1985,17 @@ enum {
MOXA_SUPP_RS485 = BIT(2),
};
+static unsigned short moxa_get_nports(unsigned short device)
+{
+ switch (device) {
+ case PCI_DEVICE_ID_MOXA_CP116E_A_A:
+ case PCI_DEVICE_ID_MOXA_CP116E_A_B:
+ return 8;
+ }
+
+ return FIELD_GET(0x00F0, device);
+}
+
static bool pci_moxa_is_mini_pcie(unsigned short device)
{
if (device == PCI_DEVICE_ID_MOXA_CP102N ||
@@ -2038,7 +2049,7 @@ static int pci_moxa_init(struct pci_dev *dev)
{
unsigned short device = dev->device;
resource_size_t iobar_addr = pci_resource_start(dev, 2);
- unsigned int num_ports = (device & 0x00F0) >> 4, i;
+ unsigned int i, num_ports = moxa_get_nports(device);
u8 val, init_mode = MOXA_RS232;
if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) {
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] tty: serial: 8250: Fixes: Fix port count mismatch with the device
2024-06-14 9:03 [PATCH] tty: serial: 8250: Fixes: Fix port count mismatch with the device Crescent Hsieh
@ 2024-06-14 9:07 ` Greg Kroah-Hartman
2024-06-15 5:36 ` Crescent CY Hsieh
0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2024-06-14 9:07 UTC (permalink / raw)
To: Crescent Hsieh; +Cc: Jiri Slaby, Andy Shevchenko, linux-kernel, linux-serial
On Fri, Jun 14, 2024 at 05:03:22PM +0800, Crescent Hsieh wrote:
> Normally, the number of ports is indicated by the third digit of the
> device ID on Moxa PCI serial boards. For example, `0x1121` indicates a
> device with 2 ports.
>
> However, `CP116E_A_A` and `CP116E_A_B` are exceptions; they have 8
> ports, but the third digit of the device ID is `6`.
>
> This patch introduces a function to retrieve the number of ports on Moxa
> PCI serial boards, addressing the issue described above.
>
> Signed-off-by: Crescent Hsieh <crescentcy.hsieh@moxa.com>
> ---
> drivers/tty/serial/8250/8250_pci.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
What commit id does this fix?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tty: serial: 8250: Fixes: Fix port count mismatch with the device
2024-06-14 9:07 ` Greg Kroah-Hartman
@ 2024-06-15 5:36 ` Crescent CY Hsieh
2024-06-15 6:18 ` Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: Crescent CY Hsieh @ 2024-06-15 5:36 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Jiri Slaby, Andy Shevchenko, linux-kernel, linux-serial
On Fri, Jun 14, 2024 at 11:07:29AM +0200, Greg Kroah-Hartman wrote:
> On Fri, Jun 14, 2024 at 05:03:22PM +0800, Crescent Hsieh wrote:
> > Normally, the number of ports is indicated by the third digit of the
> > device ID on Moxa PCI serial boards. For example, `0x1121` indicates a
> > device with 2 ports.
> >
> > However, `CP116E_A_A` and `CP116E_A_B` are exceptions; they have 8
> > ports, but the third digit of the device ID is `6`.
> >
> > This patch introduces a function to retrieve the number of ports on Moxa
> > PCI serial boards, addressing the issue described above.
> >
> > Signed-off-by: Crescent Hsieh <crescentcy.hsieh@moxa.com>
> > ---
> > drivers/tty/serial/8250/8250_pci.c | 13 ++++++++++++-
> > 1 file changed, 12 insertions(+), 1 deletion(-)
>
> What commit id does this fix?
None, it's just a normal patch, I might have mistakenly added the "fix"
tag.
---
Sincerely,
Crescent Hsieh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tty: serial: 8250: Fixes: Fix port count mismatch with the device
2024-06-15 5:36 ` Crescent CY Hsieh
@ 2024-06-15 6:18 ` Greg Kroah-Hartman
2024-06-16 4:16 ` Crescent CY Hsieh
0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2024-06-15 6:18 UTC (permalink / raw)
To: Crescent CY Hsieh; +Cc: Jiri Slaby, Andy Shevchenko, linux-kernel, linux-serial
On Sat, Jun 15, 2024 at 01:36:52PM +0800, Crescent CY Hsieh wrote:
> On Fri, Jun 14, 2024 at 11:07:29AM +0200, Greg Kroah-Hartman wrote:
> > On Fri, Jun 14, 2024 at 05:03:22PM +0800, Crescent Hsieh wrote:
> > > Normally, the number of ports is indicated by the third digit of the
> > > device ID on Moxa PCI serial boards. For example, `0x1121` indicates a
> > > device with 2 ports.
> > >
> > > However, `CP116E_A_A` and `CP116E_A_B` are exceptions; they have 8
> > > ports, but the third digit of the device ID is `6`.
> > >
> > > This patch introduces a function to retrieve the number of ports on Moxa
> > > PCI serial boards, addressing the issue described above.
> > >
> > > Signed-off-by: Crescent Hsieh <crescentcy.hsieh@moxa.com>
> > > ---
> > > drivers/tty/serial/8250/8250_pci.c | 13 ++++++++++++-
> > > 1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > What commit id does this fix?
>
> None, it's just a normal patch, I might have mistakenly added the "fix"
> tag.
You say "fix" twice in the subject line, and it looks like it actually
does resolve a problem in the current code.
Or is this all just a "cleanup" change?
confused,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tty: serial: 8250: Fixes: Fix port count mismatch with the device
2024-06-15 6:18 ` Greg Kroah-Hartman
@ 2024-06-16 4:16 ` Crescent CY Hsieh
2024-06-16 20:06 ` Andy Shevchenko
0 siblings, 1 reply; 6+ messages in thread
From: Crescent CY Hsieh @ 2024-06-16 4:16 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Jiri Slaby, Andy Shevchenko, linux-kernel, linux-serial
On Sat, Jun 15, 2024 at 08:18:41AM +0200, Greg Kroah-Hartman wrote:
> On Sat, Jun 15, 2024 at 01:36:52PM +0800, Crescent CY Hsieh wrote:
> > On Fri, Jun 14, 2024 at 11:07:29AM +0200, Greg Kroah-Hartman wrote:
> > > On Fri, Jun 14, 2024 at 05:03:22PM +0800, Crescent Hsieh wrote:
> > > > Normally, the number of ports is indicated by the third digit of the
> > > > device ID on Moxa PCI serial boards. For example, `0x1121` indicates a
> > > > device with 2 ports.
> > > >
> > > > However, `CP116E_A_A` and `CP116E_A_B` are exceptions; they have 8
> > > > ports, but the third digit of the device ID is `6`.
> > > >
> > > > This patch introduces a function to retrieve the number of ports on Moxa
> > > > PCI serial boards, addressing the issue described above.
> > > >
> > > > Signed-off-by: Crescent Hsieh <crescentcy.hsieh@moxa.com>
> > > > ---
> > > > drivers/tty/serial/8250/8250_pci.c | 13 ++++++++++++-
> > > > 1 file changed, 12 insertions(+), 1 deletion(-)
> > >
> > > What commit id does this fix?
> >
> > None, it's just a normal patch, I might have mistakenly added the "fix"
> > tag.
>
> You say "fix" twice in the subject line, and it looks like it actually
> does resolve a problem in the current code.
>
> Or is this all just a "cleanup" change?
>
> confused,
After reviewing what this patch has done, I found that it does fix the
problem of retrieving the wrong number of ports on some Moxa PCI serial
devices. However, this issue is not severe enough to cause any system
problems.
Sorry for the confusion.
---
Sincerely,
Crescent Hsieh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tty: serial: 8250: Fixes: Fix port count mismatch with the device
2024-06-16 4:16 ` Crescent CY Hsieh
@ 2024-06-16 20:06 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2024-06-16 20:06 UTC (permalink / raw)
To: Crescent CY Hsieh
Cc: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial
On Sun, Jun 16, 2024 at 6:16 AM Crescent CY Hsieh
<crescentcy.hsieh@moxa.com> wrote:
> On Sat, Jun 15, 2024 at 08:18:41AM +0200, Greg Kroah-Hartman wrote:
> > On Sat, Jun 15, 2024 at 01:36:52PM +0800, Crescent CY Hsieh wrote:
> > > On Fri, Jun 14, 2024 at 11:07:29AM +0200, Greg Kroah-Hartman wrote:
> > > > On Fri, Jun 14, 2024 at 05:03:22PM +0800, Crescent Hsieh wrote:
...
> > > > What commit id does this fix?
> > >
> > > None, it's just a normal patch, I might have mistakenly added the "fix"
> > > tag.
> >
> > You say "fix" twice in the subject line, and it looks like it actually
> > does resolve a problem in the current code.
> >
> > Or is this all just a "cleanup" change?
> >
> > confused,
>
> After reviewing what this patch has done, I found that it does fix the
> problem of retrieving the wrong number of ports on some Moxa PCI serial
> devices. However, this issue is not severe enough to cause any system
> problems.
Yes, but it is still a fix. So, which commit does it fix? We may add a
Fixes tag then.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-06-16 20:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-14 9:03 [PATCH] tty: serial: 8250: Fixes: Fix port count mismatch with the device Crescent Hsieh
2024-06-14 9:07 ` Greg Kroah-Hartman
2024-06-15 5:36 ` Crescent CY Hsieh
2024-06-15 6:18 ` Greg Kroah-Hartman
2024-06-16 4:16 ` Crescent CY Hsieh
2024-06-16 20:06 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox