Search Linux Wireless

RE: [PATCH 5/9] wifi: rtw88: Add rtw8703b.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Ping-Ke Shih <pkshih@xxxxxxxxxxx>
> Sent: Tuesday, February 6, 2024 9:38 AM
> To: Fiona Klute <fiona.klute@xxxxxx>; linux-wireless@xxxxxxxxxxxxxxx
> Cc: Kalle Valo <kvalo@xxxxxxxxxx>; Ulf Hansson <ulf.hansson@xxxxxxxxxx>; linux-mmc@xxxxxxxxxxxxxxx; Pavel
> Machek <pavel@xxxxxx>; Ondřej Jirman <megi@xxxxxx>
> Subject: RE: [PATCH 5/9] wifi: rtw88: Add rtw8703b.c
> 
> 
> 
> > -----Original Message-----
> > From: Fiona Klute <fiona.klute@xxxxxx>
> > Sent: Tuesday, February 6, 2024 3:06 AM
> > To: Ping-Ke Shih <pkshih@xxxxxxxxxxx>; linux-wireless@xxxxxxxxxxxxxxx
> > Cc: Kalle Valo <kvalo@xxxxxxxxxx>; Ulf Hansson <ulf.hansson@xxxxxxxxxx>; linux-mmc@xxxxxxxxxxxxxxx;
> Pavel
> > Machek <pavel@xxxxxx>; Ondřej Jirman <megi@xxxxxx>
> > Subject: Re: [PATCH 5/9] wifi: rtw88: Add rtw8703b.c
> >
> > >> +
> > >> +       if (ret != 0)
> > >> +               return ret;
> > >> +
> > >> +#ifdef CONFIG_OF
> > >> +       /* Prefer MAC from DT, if available. On some devices like the
> > >> +        * Pinephone that might be the only way to get a valid MAC.
> > >> +        */
> > >> +       struct device_node *node = rtwdev->dev->of_node;
> > >
> > > Should move this statement to topmost of this function? no compiler warning?
> > >
> > > Or, make an individual function to read mac addr from DT?
> >
> > I can move that to a separate function if you prefer, see below for the
> > compiler warning.
> 
> Because this is CONFIG_OF chunk, it will look like below if you move declaration upward:
> 
> #ifdef CONFIG_OF
> 	struct device_node *node = rtwdev->dev->of_node;
> #endif
> 	// other declaration ...
> 
> 	// other code
> #ifdef CONFIG_OF
> 	if (node) {
> 		...
> 	}
> #endif
> 
> It seems like too much #ifdef. With a separate function, it can be single #ifdef.
> That is my point.
> 

If CONFIG_OF isn't defined, compiler will select a static inline function that
just returns -ENODEV [1], so I think you don't need a #ifdef chunk here. 

[1] https://elixir.bootlin.com/linux/latest/source/include/linux/of_net.h#L27







[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux