Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp857832ybb; Wed, 1 Apr 2020 10:55:58 -0700 (PDT) X-Google-Smtp-Source: APiQypIEE8urHdOTwdE0XoZjlCFYk/7T7LTtm41xtG6tt0+BG+FT8eyHS9nYIvkHGcvLTePRZIer X-Received: by 2002:aca:61d4:: with SMTP id v203mr3834959oib.72.1585763758600; Wed, 01 Apr 2020 10:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585763758; cv=none; d=google.com; s=arc-20160816; b=SGHPJlIadyKu0PVxnQOu8pGxlV5rGaqnSACLfB9QQOS6v25Ps4PzvqaWbtwsCfRK1I 4sciPgyq1mX8ew283lHPzF+7CBnFPOLkcBX5/olWZkADHOHK/5S5twWiSvvo03bQ0K6F kxJ9iI4giM+wkB77DGYIL5j4vxiVy2GMs/4Rig1gifJg8atcIEz9l+eehGqE2RQFUOVk J9INOB7KDc8mTkg1RnWr/f3QTIacx92zW3JsyqLjrqlR5mcCoc6IUFTkioLPyHpdF40u TX0jLutzVyf/nh7QCIjALn2QMHrL5gfgcofsN10vmG4ZIQYqymK4SupNzCNEeO1DN14w jamg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=1kjcogMCLyj+JeqRmPpxj6WycRZQScrCZfax295ODXk=; b=P1ARtkOEAVi9FJnsoXPxMhi+Y5WVJB/bdmyhmpq7vU+uSsDl4omzpkheI2Vv0MgZCE tImC3VHvkVBWuobfWrQk/emlshULHxZbc6M2GsUmZC3AP/dVPNUdJRBojcboHXQTIKUr /hLfkU2bhIsDrIfuYS09S/DvAdA3vmr2X7y6gMd4y6JPZIoQ2/KUCO+ShTrdeYBP/S9T IQGEk26247E2OrCPNluoSrlHZIysmQTONBxPX+3flAN8Y4GvQA8U+eCXMWF6ImjmVD8l EB6jGccSSBF4KZTE8hhexCu8EtmRLpUOvAIbJh4E2MbcCMo6ec3vTZOjOQKHV8PLFvDf bdvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k62si1148359oif.247.2020.04.01.10.55.41; Wed, 01 Apr 2020 10:55:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732264AbgDARxS (ORCPT + 99 others); Wed, 1 Apr 2020 13:53:18 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:46330 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732121AbgDARxS (ORCPT ); Wed, 1 Apr 2020 13:53:18 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) (envelope-from ) id 1jJhYC-00CpOp-5A; Wed, 01 Apr 2020 19:53:16 +0200 Message-ID: Subject: Re: [RFC 2/7] cfg80211: express channels with a KHz component From: Johannes Berg To: Thomas Pedersen Cc: linux-wireless Date: Wed, 01 Apr 2020 19:53:15 +0200 In-Reply-To: <69451a0a-4bca-36f8-4295-9a386585c244@adapt-ip.com> References: <20200401062150.3324-1-thomas@adapt-ip.com> <20200401062150.3324-3-thomas@adapt-ip.com> <52850c8eb3131ca742eea30a21a7e685a3a3045b.camel@sipsolutions.net> <69451a0a-4bca-36f8-4295-9a386585c244@adapt-ip.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, 2020-04-01 at 10:30 -0700, Thomas Pedersen wrote: > > --- > .. c:function:: struct ieee80211_channel * ieee80211_get_channel (struct wiphy * wiphy, int freq) > > get channel struct from wiphy for specified frequency > > **Parameters** > > ``struct wiphy * wiphy`` > the struct wiphy to get the channel for > > ``int freq`` > the center frequency (in MHz) of the channel > --- > > Documentation/doc-guide/kernel-doc.rst says: > > The brief description following the function name may span multiple lines, and > ends with an argument description, a blank comment line, or the end of the > comment block. Interesting. I guess they must've fixed this at some point - at least I _seem_ to remember getting wrong output with it. Thanks for the correction! > > > +/** > > > + * ieee80211_chandef_to_khz - convert chandef to frequency in KHz > > > + * > > > + * @chandef: the chandef to convert > > > + * > > > + * Returns the center frequency of chandef (1st segment) in KHz. > > > + */ > > > +u32 ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef); > > > > Isn't this one trivial, and probably better inlined (mhz*1000 + khz)? > > Do you mean open code the conversion? I would prefer not to. If you > meant make it an inline function then yes probably. Right, I meant making it an inline. > > > +static int __ieee80211_frequency_to_channel(u32 freq) > > > > export the double-underscore helpers like this one instead? That'd still > > be less code overall, IMHO. > > I didn't want to change the interface for > ieee80211_frequency_to_channel(). It's a little confusing that one takes > MHz, but the __ieee80211_frequency_to_channel() takes KHz? By giving the > _khz() hint in the wrapper we were trying to make it explicit. Similar > to below. Right. I think that's fine. I was just wondering if / thinking that it may be better to just export ieee80211_freq_khz_to_channel(), and express the other ones as inline function in terms of that? > > And maybe here? In fact, how is __ieee80211_get_channel() even different > > from ieee80211_get_channel_khz()? > > It's not. I thought the _khz() hint was helpful for the reader to keep > the units straight. Agree, but then you don't need the double-underscore version and can just express the old one in terms of the _khz one? > What do you think about keeping the interfaces in place, but otherwise > converting them to inline functions (where it makes sense)? Yes, I think that's what I had in mind. > I'd like to avoid open coding the conversions and otherwise keep the > gory internals of the channel structures hidden from the caller. Agree. johannes