cfg80211: add wiphy_idx_valid to check for wiphy_idx sanity

This will later be used by others, for now make use of it in
cfg80211_drv_by_wiphy_idx() to return early if an invalid
wiphy_idx has been provided.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Luis R. Rodriguez
2009-02-21 00:04:20 -05:00
committed by John W. Linville
parent b5850a7a4f
commit 85fd129a72
2 changed files with 11 additions and 1 deletions

View File

@ -63,6 +63,13 @@ struct cfg80211_registered_device *wiphy_to_dev(struct wiphy *wiphy)
return container_of(wiphy, struct cfg80211_registered_device, wiphy);
}
/* Note 0 is valid, hence phy0 */
static inline
bool wiphy_idx_valid(int wiphy_idx)
{
return (wiphy_idx >= 0);
}
extern struct mutex cfg80211_drv_mutex;
extern struct list_head cfg80211_drv_list;