kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* What is "#define alloc_ieee80211  alloc_ieee80211_rsl"?
@ 2018-10-09 19:07 John Whitmore
  2018-10-09 19:13 ` John Whitmore
  2018-10-09 23:48 ` valdis.kletnieks at vt.edu
  0 siblings, 2 replies; 3+ messages in thread
From: John Whitmore @ 2018-10-09 19:07 UTC (permalink / raw)
  To: kernelnewbies

Sorry I know what a #define is doing, but in this case I've no idea
why it's used and what it's trying to achieve.

This is from the rtl8192u driver in staging, where the alloc function
(alloc_ieee80211) which is called by the probe function
(rtl8192_usb_probe). So that's all good but a quick grep through the
code and in the file drivers/staging/rtl8192u/ieee80211/ieee80211.h
there's a line which defines that function as another function '_rsl'
which don't exist anywhere in Kernel.

#define alloc_ieee80211			alloc_ieee80211_rsl

So what am I missing or why are a number of functions being redefined
as another name, which doesn't exist?

I'm tempted to remove any that don't exist but I should really find
out what it is the lines are doing.

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

* What is "#define alloc_ieee80211  alloc_ieee80211_rsl"?
  2018-10-09 19:07 What is "#define alloc_ieee80211 alloc_ieee80211_rsl"? John Whitmore
@ 2018-10-09 19:13 ` John Whitmore
  2018-10-09 23:48 ` valdis.kletnieks at vt.edu
  1 sibling, 0 replies; 3+ messages in thread
From: John Whitmore @ 2018-10-09 19:13 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Oct 09, 2018 at 08:07:08PM +0100, John Whitmore wrote:
> Sorry I know what a #define is doing, but in this case I've no idea
> why it's used and what it's trying to achieve.
> 
> This is from the rtl8192u driver in staging, where the alloc function
> (alloc_ieee80211) which is called by the probe function
> (rtl8192_usb_probe). So that's all good but a quick grep through the
> code and in the file drivers/staging/rtl8192u/ieee80211/ieee80211.h
> there's a line which defines that function as another function '_rsl'
> which don't exist anywhere in Kernel.
> 
> #define alloc_ieee80211			alloc_ieee80211_rsl
> 
> So what am I missing or why are a number of functions being redefined
> as another name, which doesn't exist?
> 
> I'm tempted to remove any that don't exist but I should really find
> out what it is the lines are doing.

I should have held off for a few minutes. I removed all the '_rsl'
defines from the code and the module re-builds so I think I'll just
submit a patch. Unless somebody has a good reason not to.

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

* What is "#define alloc_ieee80211 alloc_ieee80211_rsl"?
  2018-10-09 19:07 What is "#define alloc_ieee80211 alloc_ieee80211_rsl"? John Whitmore
  2018-10-09 19:13 ` John Whitmore
@ 2018-10-09 23:48 ` valdis.kletnieks at vt.edu
  1 sibling, 0 replies; 3+ messages in thread
From: valdis.kletnieks at vt.edu @ 2018-10-09 23:48 UTC (permalink / raw)
  To: kernelnewbies

On Tue, 09 Oct 2018 20:07:08 +0100, John Whitmore said:

> #define alloc_ieee80211			alloc_ieee80211_rsl
>
> So what am I missing or why are a number of functions being redefined
> as another name, which doesn't exist?

There's areas in the kernel which use the preprocessor ## to glue stuff
together. see include/asm-generic/atomic-long.h  and ATOMIC_LONG_FETCH_OP for
an example. It's also use in some code to generate function names to initialize
a structure of function pointers.  This can make grepping for a function name
troublesome if you don't realize there's ## abuse going on to create a function
name on the fly.

However, in this particular case, it looks like they're redirecting an
allocator so that for rtl8192u, when common/copypasted code calls
alloc_ieee80211 it gets redirected to their own version...

[/usr/src/linux-next] git grep alloc_ieee80211
drivers/staging/rtl8192u/ieee80211/ieee80211.h:#define alloc_ieee80211                  alloc_ieee80211_rsl
drivers/staging/rtl8192u/ieee80211/ieee80211.h:  * allocated beyond this structure by alloc_ieee80211
drivers/staging/rtl8192u/ieee80211/ieee80211.h:struct net_device *alloc_ieee80211(int sizeof_priv);
drivers/staging/rtl8192u/ieee80211/ieee80211_module.c:struct net_device *alloc_ieee80211(int sizeof_priv)
drivers/staging/rtl8192u/r8192U_core.c: dev = alloc_ieee80211(sizeof(struct r8192_priv));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20181009/637c6950/attachment.sig>

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

end of thread, other threads:[~2018-10-09 23:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 19:07 What is "#define alloc_ieee80211 alloc_ieee80211_rsl"? John Whitmore
2018-10-09 19:13 ` John Whitmore
2018-10-09 23:48 ` valdis.kletnieks at vt.edu

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).