All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drivers/serial/16550A_pci.h: allow custom baud_base with pci cards
@ 2022-05-27 21:34 Konstantin Smola
  2022-05-27 21:48 ` Richard Weinberger
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Smola @ 2022-05-27 21:34 UTC (permalink / raw)
  To: xenomai; +Cc: Konstantin Smola

pci probe was overwriting baud_base with default values, ignoring baud_base arguments passed in while loading driver.

Signed-off-by: Konstantin Smola <ksmola51@gmail.com>
---
 kernel/drivers/serial/16550A_pci.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/drivers/serial/16550A_pci.h b/kernel/drivers/serial/16550A_pci.h
index 91b0390..b747a10 100644
--- a/kernel/drivers/serial/16550A_pci.h
+++ b/kernel/drivers/serial/16550A_pci.h
@@ -244,7 +244,8 @@ static int rt_16550_pci_probe(struct pci_dev *pdev,
 			io[i] = base_addr + port * board->port_ofs;
 			irq[i] = pdev->irq;
 			irqtype[i] = board->irqtype;
-			baud_base[i] = board->baud_base;
+         if (baud_base[i] == 0)
+			   baud_base[i] = board->baud_base;
 			tx_fifo[i] = board->tx_fifo;
 			port++;
 		}
-- 
2.1.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] drivers/serial/16550A_pci.h: allow custom baud_base with pci cards
  2022-05-27 21:34 [PATCH 1/1] drivers/serial/16550A_pci.h: allow custom baud_base with pci cards Konstantin Smola
@ 2022-05-27 21:48 ` Richard Weinberger
  2022-06-08 15:15   ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2022-05-27 21:48 UTC (permalink / raw)
  To: Konstantin Smola; +Cc: Xenomai

On Fri, May 27, 2022 at 11:35 PM Konstantin Smola via Xenomai
<xenomai@xenomai.org> wrote:
>
> pci probe was overwriting baud_base with default values, ignoring baud_base arguments passed in while loading driver.
>
> Signed-off-by: Konstantin Smola <ksmola51@gmail.com>
> ---
>  kernel/drivers/serial/16550A_pci.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/drivers/serial/16550A_pci.h b/kernel/drivers/serial/16550A_pci.h
> index 91b0390..b747a10 100644
> --- a/kernel/drivers/serial/16550A_pci.h
> +++ b/kernel/drivers/serial/16550A_pci.h
> @@ -244,7 +244,8 @@ static int rt_16550_pci_probe(struct pci_dev *pdev,
>                         io[i] = base_addr + port * board->port_ofs;
>                         irq[i] = pdev->irq;
>                         irqtype[i] = board->irqtype;
> -                       baud_base[i] = board->baud_base;
> +         if (baud_base[i] == 0)
> +                          baud_base[i] = board->baud_base;

This assumes that the i-th baud_base you specify as module parameter
will also be
the i-th probed PCI driver.
But PCI can probe devices in any order, even userspace an unbind/bind
them at will.

-- 
Thanks,
//richard


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] drivers/serial/16550A_pci.h: allow custom baud_base with pci cards
  2022-05-27 21:48 ` Richard Weinberger
@ 2022-06-08 15:15   ` Jan Kiszka
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2022-06-08 15:15 UTC (permalink / raw)
  To: Richard Weinberger, Konstantin Smola; +Cc: Xenomai

On 27.05.22 23:48, Richard Weinberger via Xenomai wrote:
> On Fri, May 27, 2022 at 11:35 PM Konstantin Smola via Xenomai
> <xenomai@xenomai.org> wrote:
>>
>> pci probe was overwriting baud_base with default values, ignoring baud_base arguments passed in while loading driver.
>>
>> Signed-off-by: Konstantin Smola <ksmola51@gmail.com>
>> ---
>>  kernel/drivers/serial/16550A_pci.h | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/drivers/serial/16550A_pci.h b/kernel/drivers/serial/16550A_pci.h
>> index 91b0390..b747a10 100644
>> --- a/kernel/drivers/serial/16550A_pci.h
>> +++ b/kernel/drivers/serial/16550A_pci.h
>> @@ -244,7 +244,8 @@ static int rt_16550_pci_probe(struct pci_dev *pdev,
>>                         io[i] = base_addr + port * board->port_ofs;
>>                         irq[i] = pdev->irq;
>>                         irqtype[i] = board->irqtype;
>> -                       baud_base[i] = board->baud_base;
>> +         if (baud_base[i] == 0)
>> +                          baud_base[i] = board->baud_base;
> 
> This assumes that the i-th baud_base you specify as module parameter
> will also be
> the i-th probed PCI driver.
> But PCI can probe devices in any order, even userspace an unbind/bind
> them at will.
> 

Yeah, this whole index-based param passing at least became fragile over
the past 15 years (time passed...), if it wasn't back then already. But
I think this is not getting worse with this patch, is it?

What is getting a little bit worse is the coding style. Please fix
indentions.

Jan

PS: Some "rtsetserial" to claim and parameterize an RTDM UART would
likely be nicer, long-term.

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-08 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27 21:34 [PATCH 1/1] drivers/serial/16550A_pci.h: allow custom baud_base with pci cards Konstantin Smola
2022-05-27 21:48 ` Richard Weinberger
2022-06-08 15:15   ` Jan Kiszka

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.