Message ID | 20220329152430.756947-4-miquel.raynal@bootlin.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | serial: 8250: dw: RZN1 DMA support | expand |
On Tue, Mar 29, 2022 at 05:24:23PM +0200, Miquel Raynal wrote: > Unsigned int is better than unsigned long as its size does not change > between setups and we don't really need this variable to be more than a > few bits wide for now. > > Suggested-by: Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> One tag is enough :-) Looking into the following patch, I think you may squash this one into it, just add an explanation in the commit message that you reduced variable for quirks.
Hi Miquel, On Tue, Mar 29, 2022 at 5:24 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote: > Unsigned int is better than unsigned long as its size does not change > between setups and we don't really need this variable to be more than a > few bits wide for now. > > Suggested-by: Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Thanks for your patch! > --- a/drivers/tty/serial/8250/8250_dw.c > +++ b/drivers/tty/serial/8250/8250_dw.c > @@ -376,7 +376,7 @@ static bool dw8250_idma_filter(struct dma_chan *chan, void *param) > static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) > { > struct device_node *np = p->dev->of_node; > - unsigned long quirks = (unsigned long)device_get_match_data(p->dev); > + unsigned int quirks = (unsigned int)device_get_match_data(p->dev); "(uintptr_t)" (or "(unsigned long)" ;-), else you'll get a "cast from pointer to integer of different size" warning on 64-bit builds. > > if (np) { > int id; Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Geert, geert@linux-m68k.org wrote on Tue, 29 Mar 2022 17:58:40 +0200: > Hi Miquel, > > On Tue, Mar 29, 2022 at 5:24 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote: > > Unsigned int is better than unsigned long as its size does not change > > between setups and we don't really need this variable to be more than a > > few bits wide for now. > > > > Suggested-by: Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> > > Thanks for your patch! > > > --- a/drivers/tty/serial/8250/8250_dw.c > > +++ b/drivers/tty/serial/8250/8250_dw.c > > @@ -376,7 +376,7 @@ static bool dw8250_idma_filter(struct dma_chan *chan, void *param) > > static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) > > { > > struct device_node *np = p->dev->of_node; > > - unsigned long quirks = (unsigned long)device_get_match_data(p->dev); > > + unsigned int quirks = (unsigned int)device_get_match_data(p->dev); > > "(uintptr_t)" (or "(unsigned long)" ;-), else you'll get a "cast from > pointer to integer of different size" warning on 64-bit builds. Actually as I'm changing that quirks entry from being the entire device data to be a member of a wider structure, I'll change its type when doing the switch to avoid such a warning. Thanks, Miquèl
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 28f0dea2ed88..20c9ca03225b 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -376,7 +376,7 @@ static bool dw8250_idma_filter(struct dma_chan *chan, void *param) static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) { struct device_node *np = p->dev->of_node; - unsigned long quirks = (unsigned long)device_get_match_data(p->dev); + unsigned int quirks = (unsigned int)device_get_match_data(p->dev); if (np) { int id;
Unsigned int is better than unsigned long as its size does not change between setups and we don't really need this variable to be more than a few bits wide for now. Suggested-by: Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> --- drivers/tty/serial/8250/8250_dw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)