Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4664406pxu; Tue, 13 Oct 2020 04:19:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEobSPWxdKP5qJa40Aee+DYY2J6zfK9FXQL4CsWZxCfwisi826RdaJ7Vu6764qZBJZhOOq X-Received: by 2002:a17:906:7113:: with SMTP id x19mr32728501ejj.59.1602587967226; Tue, 13 Oct 2020 04:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602587967; cv=none; d=google.com; s=arc-20160816; b=lMvPyq8rX3Fj6y5woj1tahXKqUgjhxVaRnewIdZvg59XPWGtY/CsTLsZ9yqhmJcMbh WC/h0kBdqFY9AOGW/B/rRXdkCV4Vp8Z6kEEzL/2Zkob5g52xaa4CgPme9BYXjF1js/FH LGC4JJZjEQqmq3vR7KUPYIGFzJwfy2A043mNfXmrTx/sXfoykT2zuBMIKwwb40P4CqX9 r6QwQRHoBA0SHu2BCluvcSbgMG1jz6qmex04IJz2/YNx/DS7PhAOcuvPWu7LWQe28VIj mE0P+qEY4AYyMZIHSxhjkojFvJF9HEY8FJKLod6P3sTqEmTwV98LLaItNlcrY1b3uVVM I7AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/9A0K1IzOHna1C0DxmV3XpbQqnDKqQQDF6op5A/lIOE=; b=C4SqXyIBNN7pcaPoE/DxkR7DdLSTC64gpRh3Z2/QHLo5avcgid5BrTIDm7SKMPp9Y1 LqcDaZgqrtPYO7diFvUe71pJNK9WMMtTz9MsUyzvZs/dLbyAXZf0bd/cLJ7+D1vVy6Jf xmlHPL3fFi05ITeAGlu3K+pDoFPjGxjrnXgyPf74NheZQSBVl80JJuGcn0w0U06qp7Pm D73lZw9sN3NiA2cjLn2o3YprLe7TcVkQskrL9RsIAkHRmpEW4QK9zcegSquDcq5mdxZC XvoVwdOJIZRGaxJI6B3JGFfNCT0fDBKiTHSvrRKRdZA4VRhTGQkYyM5rU3OdL66Chs12 YuMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yo4t8KHi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rn4si11809453ejb.77.2020.10.13.04.19.05; Tue, 13 Oct 2020 04:19:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yo4t8KHi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728079AbgJMBSQ (ORCPT + 99 others); Mon, 12 Oct 2020 21:18:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727950AbgJMBSQ (ORCPT ); Mon, 12 Oct 2020 21:18:16 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 536DFC0613D0; Mon, 12 Oct 2020 18:18:16 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id x13so12868546pfa.9; Mon, 12 Oct 2020 18:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/9A0K1IzOHna1C0DxmV3XpbQqnDKqQQDF6op5A/lIOE=; b=Yo4t8KHitl7IijBwyBzbt+gmWaEcnfLB3k5bFe3RMkLOZGpv7uckNpQTdsfI1voSeo j/+15lQPSXGjI3uFic49xOYnjSCdFWRGO/fT1AtPB0eI6zk92pqx5ehhY4xJnk3rVALk ddkysd6k7Q3qCTPL299gXm2zoy8Kak3S5Qo60VN7TKbhWfirdSGdLmOYgPgv4y+qkCvd 50S6QKUxR8Ey/wFnaMDDtatK4M6BZ24Yq9Xg1iPO5LbguUw3ygoT9MF454psQy7MW2gC urQ1gJaKpQ8XbW/mk+PZh0gmOZTST/vFP1P7F3zPSmNF1ceNYj1OHrCi+hoMbfMfWtC9 GRzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/9A0K1IzOHna1C0DxmV3XpbQqnDKqQQDF6op5A/lIOE=; b=YzmcsiHJtCDnyqYQzSDudV5aCY0Vf7UZ18i7+as5ZSpBqjIgd3b70o9u5Lume6oqCh CPyJCjxNruTT1CygCkCHkt4RqknMzEV3U1LyFKgoQXaBzFE07fyiYCBI1wcXP+wlHgWO +GN8v9n9RTpFrVrfktd9t0lD/OAyU0/JaskqYngo/U3olcN84uaA4zEd28H9oik6KKsA VD/7OsO+kVpVQKbSAzGeX7Wk9bvGDSDzyq9Plf6U+31D5eQuyQRK6jHKr5JCy6GtHNQg /z5mr2Z53a3uFvw32ZHkZWfN2uCfO9oaF4XQaF9qUd/lLP9n3BuaDDiaGTnD7fBy6MUt kLjw== X-Gm-Message-State: AOAM5300XwAyQPLR5c4xV89Jfw08RAUCvZZnshNLl21G4cgxYKXV7R3s RtW/B/ZNMCrZEjQRAGwm9QOllhEgShJ/uw== X-Received: by 2002:a17:90b:17c4:: with SMTP id me4mr21967291pjb.91.1602551895798; Mon, 12 Oct 2020 18:18:15 -0700 (PDT) Received: from f3 (ae055068.dynamic.ppp.asahi-net.or.jp. [14.3.55.68]) by smtp.gmail.com with ESMTPSA id b6sm24476508pjq.42.2020.10.12.18.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 18:18:14 -0700 (PDT) Date: Tue, 13 Oct 2020 10:18:10 +0900 From: Benjamin Poirier To: Coiby Xu Cc: devel@driverdev.osuosl.org, Shung-Hsi Yu , Manish Chopra , "supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER" , Greg Kroah-Hartman , "open list:QLOGIC QLGE 10Gb ETHERNET DRIVER" , open list Subject: Re: [PATCH v1 2/6] staging: qlge: coredump via devlink health reporter Message-ID: <20201013011810.GB41031@f3> References: <20201008115808.91850-1-coiby.xu@gmail.com> <20201008115808.91850-3-coiby.xu@gmail.com> <20201010074809.GB14495@f3> <20201010100258.px2go6nugsfbwoq7@Rk> <20201010132230.GA17351@f3> <20201012115114.lyh33rvmm4rt7mej@Rk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201012115114.lyh33rvmm4rt7mej@Rk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-10-12 19:51 +0800, Coiby Xu wrote: > On Sat, Oct 10, 2020 at 10:22:30PM +0900, Benjamin Poirier wrote: > > On 2020-10-10 18:02 +0800, Coiby Xu wrote: > > [...] > > > > > + do { \ > > > > > + err = fill_seg_(fmsg, &dump->seg_hdr, dump->seg_regs); \ > > > > > + if (err) { \ > > > > > + kvfree(dump); \ > > > > > + return err; \ > > > > > + } \ > > > > > + } while (0) > > > > > + > > > > > +static int qlge_reporter_coredump(struct devlink_health_reporter *reporter, > > > > > + struct devlink_fmsg *fmsg, void *priv_ctx, > > > > > + struct netlink_ext_ack *extack) > > > > > +{ > > > > > + int err = 0; > > > > > + > > > > > + struct qlge_devlink *dev = devlink_health_reporter_priv(reporter); > > > > > > > > Please name this variable ql_devlink, like in qlge_probe(). > > > > > > I happened to find the following text in drivers/staging/qlge/TODO > > > > * in terms of namespace, the driver uses either qlge_, ql_ (used by > > > > other qlogic drivers, with clashes, ex: ql_sem_spinlock) or nothing (with > > > > clashes, ex: struct ob_mac_iocb_req). Rename everything to use the "qlge_" > > > > prefix. > > > > This comment applies to global identifiers, not local variables. > > Thank you for the explanation! Are you suggesting we should choose > different naming styles so we better tell global identifiers from local > variables? That's not the main purpose IMO. Using a consistent prefix for global identifiers (ex. "qlge_") is to avoid clashes (two drivers using the same name, as in the examples above). Strictly speaking, it is not a problem for symbols with internal linkage (ex. static functions) or type definitions in local header files but it makes the code clearer because it shows immediately that this identifier was defined in the driver. For local variables, the name is more a matter of personal taste I think but it should be consistent within the driver and with other users of the same api, where applicable. A prefix is not needed but the name is sometimes a simpler version of a type name which includes a prefix. > > > So I will adopt qlge_ instead. Besides I prefer qlge_dl to ql_devlink. > > > > Up to you but personally, I think ql_devlink is better. In any case, > > "dev" is too general and often used for struct net_device pointers > > instead. > > Thank you for the suggestion. Another reason to use qlge_dl is many > other network drivers supporting devlink interface also adopt this kind > of style. Sounds good. On second thought I regretted suggesting ql_devlink. While local variable don't need any prefix; if they do have one, better not mix qlge_ and ql_.