Search Linux Wireless

Re: Optimization: keeping pointer all the time, or defining getter?

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

 



On Wed, 2011-05-11 at 18:22 +0200, RafaÅ MiÅecki wrote: 
> I try to abstract bus in b43 driver. For frequently used fields
> solution is obvious:
> At init time I get info from bus-specific stuct and put it in generic field.
> Example: core revision. We often refer to it, I put it in abstraction struct.
> 
> My question: what is the policy for cases with less frequently used fields?
> Example: I need to use "struct device" for registering some low lever stuff.
> 
> I have two solutions:
> 
> 1) Realtime:
> struct device *get_device(...)
> {
> if (dev->bus_type = B43_BUS_SSB)
> return dev->ssbdev->device;
> else if (dev->bus_type = B43_BUS_BCMA)
> return dev->bcmadev->device;
> }
> 
> 2) Init time:
> void b43_ssb_init(struct ssb_device *ssbdev)
> {
> dev->struct = ssbdev->device;
> }
> 
> The first one is slower but we don't keep "struct device" pointer in
> abstraction struct. Situation is opposite for the second one.
> 
> Does anyone care? ;)

Put a struct device pointer into b43_wldev.
The pointer is needed on every DMA transaction several times, so this
seems worth it.

-- 
Greetings Michael.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux