Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755181AbbL3RFh (ORCPT ); Wed, 30 Dec 2015 12:05:37 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:34153 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755058AbbL3RFe (ORCPT ); Wed, 30 Dec 2015 12:05:34 -0500 MIME-Version: 1.0 In-Reply-To: References: <1450946006-7498-1-git-send-email-bjorn.andersson@sonymobile.com> Date: Wed, 30 Dec 2015 09:05:32 -0800 Message-ID: Subject: Re: [PATCH] mac80211: Make addr const in SET_IEEE80211_PERM_ADDR() From: Bjorn Andersson To: Souptick Joarder Cc: Johannes Berg , "David S. Miller" , linux-wireless , netdev , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1893 Lines: 52 On Wed, Dec 30, 2015 at 8:47 AM, Souptick Joarder wrote: > > HI Bjorn, > > On Thu, Dec 24, 2015 at 2:03 PM, Bjorn Andersson wrote: > > Make the addr parameter const in SET_IEEE80211_PERM_ADDR() to save > > clients from having to cast away a const qualifier. > > > > Signed-off-by: Bjorn Andersson > > --- > > include/net/mac80211.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/include/net/mac80211.h b/include/net/mac80211.h > > index 7c30faff245f..a6f3c9c4b7c2 100644 > > --- a/include/net/mac80211.h > > +++ b/include/net/mac80211.h > > @@ -2167,7 +2167,7 @@ static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev > > * @hw: the &struct ieee80211_hw to set the MAC address for > > * @addr: the address to set > > */ > > -static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) > > +static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, const u8 *addr) > > I guess without const or with const doesn't make much difference here. > Correct me if I am wrong. For most cases it doesn't make any difference, but in my driver I acquire the mac address as a const u8 *. Therefor I need to cast away the const part when calling this API. There's an existing example of this in drivers/net/wireless/st/cw1200/main.c line 601. I think it's safe to assume that this API won't ever modify the passed addr buffer, so there would be no future issues of marking the parameter const either. > > > { > > memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); > > } > Regards, Bjorn -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/