Search Linux Wireless

Re: [PATCH 2/6] cfg80211: add wiphy_idx_valid to check for wiphy_idx sanity

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

 



On Thu, 2009-02-12 at 23:08 -0800, Luis R. Rodriguez wrote:
> On Thu, Feb 12, 2009 at 10:53 PM, Johannes Berg
> <johannes@xxxxxxxxxxxxxxxx> wrote:
> > On Thu, 2009-02-12 at 21:35 -0800, Luis R. Rodriguez wrote:
> >
> >> -     if (unlikely(drv->wiphy_idx < 0)) {
> >> +     if (!wiphy_idx_valid(drv->wiphy_idx)) {
> >
> >> +/* Note 0 is valid, hence phy0 */
> >> +static inline
> >> +bool wiphy_idx_valid(int wiphy_idx)
> >> +{
> >> +     return (likely(wiphy_idx >= 0));
> >> +}
> >
> > Does that really work properly with the likely in there?
> 
> Oh you mean !likely() won't give me my unlikely() effect? I think so
> as the path is meant to not be optimized so the optimized path would
> be put first, no?

Well keep in mind that likely() also affects branch prediction on some
CPUs where you can annotate that, and I think it wouldn't be possible
for the compiler to get it out of the inline there properly.

johannes

Attachment: signature.asc
Description: This is a digitally signed message part


[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