From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18EF9C432BE for ; Tue, 31 Aug 2021 20:13:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2DCC60F4B for ; Tue, 31 Aug 2021 20:13:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240868AbhHaUOi (ORCPT ); Tue, 31 Aug 2021 16:14:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbhHaUOh (ORCPT ); Tue, 31 Aug 2021 16:14:37 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C273C061575 for ; Tue, 31 Aug 2021 13:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Pxk8GG60X+2yyobrSu3E/AhsnJLMw7NHv2ZY1OGYPLA=; b=FBEs/xlJysw8HQAyQjF7MUWNMS De2n17pxbQ2xl+NP//J2C8FdgxiOn5GaG568uQ4xBswpLfcfSotviKb/4v24SeBynq4+kZXekuzgc /euaXeiom93NNxQk+a/pGbWeZgCbc/33axph0y0UG+SSeD572JZ0l4CkK9HtjJSiczv+/cQapT7GL MuJVdbS1L1xPGUwr4ezVDYbzSjwbxnTtDqz7GEQcum7reqcsnLL324QBS1yyPHcOMqsswP+vPFZ0+ ae/4Qhu2DN0lImdyqbGJtGEEWmsoVPfF2PZDCZI5o+1wqWlLjpf1WEwz5tyY9F+rDnxd7MfyVyorg xw+sCYRA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLA7s-001Wyc-Sl; Tue, 31 Aug 2021 20:13:08 +0000 Date: Tue, 31 Aug 2021 21:12:56 +0100 From: Matthew Wilcox To: Tawah Peggy Cc: outreachy-kernel@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [Outreachy kernel] [PATCH] [Outreachy Kernel] Staging: wlan-ng: cfg80211: Fix Lines should not end with a '(' Message-ID: References: <20210824031551.GA80985@peggy-InsydeH2O-EFI-BIOS> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 30, 2021 at 01:41:58PM +0100, Tawah Peggy wrote: > Thanks for your feedback Mattew, > please what approach do you suggest I use? [please don't remove mailing lists; other people may benefit from the answers to your questions] There are a number of different approaches you can take to fixing this kind of warning. 1. Reduce indentation. This call seems to be indented 3-4 levels, so maybe it would be good to pull part of this function out into a helper function. 2. Use a local variable. type center_freq = request->channels[i]->center_freq; ieee80211_frequency_to_channel(center_freq); 3. Reduce the length of the function name. ieee80211_frequency_to_channel is quite a long identifier. Maybe it would be worth renaming. 4. Introduce a helper function, eg static inline foo something_to_channel(struct bar *channel) { return ieee80211_frequency_to_channel(channel->center_freq); } ... something_to_channel(request->channels[i]); There's a judgement call to be made, and without looking at the function in detail, I don't know which of these methods might be best. > tawah peggy > > On Tue, Aug 24, 2021 at 10:50 AM Matthew Wilcox wrote: > > > On Tue, Aug 24, 2021 at 04:15:51AM +0100, Tawah Peggy wrote: > > > - ieee80211_frequency_to_channel( > > > - request->channels[i]->center_freq); > > > + ieee80211_frequency_to_channel > > > + (request->channels[i]->center_freq); > > > > This is the wrong way to fix this warning. Function names should not be > > divorced from their arguments. > >