Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1515297rwb; Fri, 28 Jul 2023 10:26:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlHJhvGX5ExCuAnDKue9aJpO9noUQPt+gtVM64/in8d+hhIIzRU74nBPRG/dHAgAQfEXBEyw X-Received: by 2002:a17:90b:4b8c:b0:268:1b7f:257b with SMTP id lr12-20020a17090b4b8c00b002681b7f257bmr1715073pjb.24.1690565172442; Fri, 28 Jul 2023 10:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690565172; cv=none; d=google.com; s=arc-20160816; b=I7whRp5u2zS8pWeE6GNaHaNv5BdMlLwPfQCtAUEXnBuIjo0Tein9yI1uUBMyT0W/Be 2Y+995+dyT6KXuCgmk97EHLMTSm+eKf7q3GksT6u5Ja1CTyMIlTSu4IsK23eBOhndGRK XqveYNPOkXux3oVcGv0C/aVn6SdPfj/2QX6A8cUiKzH2ZRSBwHpqngQ50Y9vug3FTD1l P38S3DPX4q+VYh6qdn6oQN7K94PBJ8R6YaGfNidCPlAd52hi1800w9gkua8DPmUFXP1f tPH8DT65+U7ZOEo2W4KtFUrkF8tV2sFKTuIZHyLhEoVvt1ZlHSUszboc8F9+Nzf8YXIV pWsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=j/7aKHnWITVgoZ/UNzvyxCcfFQnF58gRdXlJW5zlNSM=; fh=5hfbQwXYoUd15gs3Ec9io7TPL9xUi6vz+bWKbUqUdK0=; b=xR/gSorxX6spgLlNn0Oj+JeSWihNlkTYR2drjg+9BUxRmmVMhGO283oeFAsalGV6YX CozznEgnosaOTizHffRmcLLL4CiT9xqCxE2JVNvKzcnTC9n49LmGgzvDNBQsDLfB7sSj bSKEUwlE68qqUY9otJAJCXkfxo2aOWQVkeED4iujN/jc2yyYNm+w5+jF9bJ1VWQlEjQl 7gyuHDOlFnD/fSK5lg3dacbbb/SC2JNDt5aqg0fMyK1AWE+oWKxoQEhFmLU+a8Lzsjrm YjiHXEf6I0V9bQOijuI3+EQ/U6oYSB22vMZDnurFiHE8IaG0BbPuNloaFcEiA5SVsKN1 kNyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=bVNuVfMe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w7-20020a17090aad4700b00263eb5054f2si3407804pjv.105.2023.07.28.10.25.59; Fri, 28 Jul 2023 10:26:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=bVNuVfMe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233697AbjG1Q7x (ORCPT + 99 others); Fri, 28 Jul 2023 12:59:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbjG1Q7u (ORCPT ); Fri, 28 Jul 2023 12:59:50 -0400 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E270AE47 for ; Fri, 28 Jul 2023 09:59:45 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id PQcJquo3y6LOdPQcJq6tXb; Fri, 28 Jul 2023 18:47:11 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1690562831; bh=j/7aKHnWITVgoZ/UNzvyxCcfFQnF58gRdXlJW5zlNSM=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=bVNuVfMew/ZG1k8SfRJox25DBH4WnyOEvUZd2GUrGCIM/q1tWtGFcPyAUeuCig43c ZHD5QYOC/CoQhTRY5IumE/ZuCmQcdDZ4E+brZ5Z1KF/KEu3Hxnyxu44j3tznKOIHTZ 5al5JCfNJk7qdx789ylDq+nsLNcx2PYSpao1lR5wqDp6SY/pU+woIokU+5PwUNyIpC k8T/76BzBfUpxt2r6/ncPW4ag9ERqENXIOjAi74vP3RNbODbO4bbyOsDmYRmYYMC48 ggjAVZNPWTwxbKutxzej6Z7sh/Org/G1I0T4KaEQXQQkXgtMf+ZT6nXT0vh+455+Ns fgPMJiWjLhH2Q== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 28 Jul 2023 18:47:11 +0200 X-ME-IP: 86.243.2.178 Message-ID: <08469a96-24f2-2099-0a0a-019cb81f976b@wanadoo.fr> Date: Fri, 28 Jul 2023 18:47:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: RE: [PATCH] Add Silicom Platform Driver To: Huibin Shi , Henry Shi , "hbshi69@hotmail.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "hdegoede@redhat.com" , "markgross@kernel.org" , "jdelvare@suse.com" , "linux@roeck-us.net" , "linux-kernel@vger.kernel.org" , "platform-driver-x86@vger.kernel.org" , "linux-hwmon@vger.kernel.org" Cc: "hb_shi2003@yahoo.com" , Wen Wang References: <20230718160104.2716-1-henryshi2018@gmail.com> Content-Language: fr, en-US From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 28/07/2023 à 14:59, Huibin Shi a écrit : > Christophe, > > Thanks for the comments. See my comments below. > > Updated patch will be sent out later after review comments from other reviewers are addressed. > > Henry > -----Original Message----- > From: Christophe JAILLET > Sent: Tuesday, July 25, 2023 5:03 PM > To: Henry Shi ; hbshi69@hotmail.com; tglx@linutronix.de; mingo@redhat.com; bp@alien8.de; dave.hansen@linux.intel.com; x86@kernel.org; hpa@zytor.com; hdegoede@redhat.com; markgross@kernel.org; jdelvare@suse.com; linux@roeck-us.net; linux-kernel@vger.kernel.org; platform-driver-x86@vger.kernel.org; linux-hwmon@vger.kernel.org > Cc: hb_shi2003@yahoo.com; Huibin Shi ; Wen Wang > Subject: Re: [PATCH] Add Silicom Platform Driver > > Caution: This is an external email. Please take care when clicking links or opening attachments. > > > Le 18/07/2023 à 18:01, Henry Shi a écrit : >> The Silicom platform (silicom-platform) Linux driver for Swisscom >> Business Box (Swisscom BB) as well as Cordoba family products is a >> software solution designed to facilitate the efficient management and >> control of devices through the integration of various Linux >> frameworks. This platform driver provides seamless support for device >> management via the Linux LED framework, GPIO framework, Hardware >> Monitoring (HWMON), and device attributes. The Silicom platform >> driver's compatibility with these Linux frameworks allows applications >> to access and control Cordoba family devices using existing software >> that is compatible with these frameworks. This compatibility >> simplifies the development process, reduces dependencies on >> proprietary solutions, and promotes interoperability with other >> Linux-based systems and software. >> >> Signed-off-by: Henry Shi >> --- > > [...] > >> +static int __init silicom_mc_leds_register(struct device *dev, >> + const struct led_classdev_mc >> +*mc_leds) { >> + struct led_classdev_mc *led; >> + int i, err; >> + >> + for (i = 0; mc_leds[i].led_cdev.name; i++) { >> + /* allocate and copy data from the init constansts */ >> + led = devm_kzalloc(dev, sizeof(struct led_classdev_mc), >> + GFP_KERNEL); > > sizeof(*led) is shorter. > Mostly a matter of taste. > > Maybe even devm_kmemdup()? > > Henry: thanks. Devm_kmemdup() API requires additional argument that is not necessary of this driver. I prefer devm_kzalloc for now. CJ: The only additionnal parameter I can think of are the one of memcpy() ... > >> + if (IS_ERR_OR_NULL(led)) { > > if (!led) > is enough. > > Henry: OK, changed > >> + dev_err(dev, "Failed to alloc >> + led_classdev_mc[%d]: %ld\n", i, PTR_ERR(led)); > > This kind of message is useless and should be removed (checkpatch should warn about it) > > Henry: OK, removed. > >> + return -ENOMEM; >> + } >> + memcpy(led, &mc_leds[i], sizeof(*led)); ... here. devm_kzalloc() + this memcpy() could be done with only devm_kmemdup(). This is mostly a matter of taste. >> + >> + led->subled_info = devm_kzalloc(dev, led->num_colors * sizeof(struct mc_subled), >> + GFP_KERNEL); > > Maybe even devm_kmemdup()? Same... > >> + if (IS_ERR_OR_NULL(led->subled_info)) { > > if (!led->subled_info) > is enough. > > Henry: OK, changed. > >> + dev_err(dev, "Failed to alloc subled_info[%d]: %ld\n", >> + i, PTR_ERR(led->subled_info)); > > This kind of message is useless and should be removed (checkpatch should warn about it) > > Henry: OK, removed. > >> + return -ENOMEM; >> + } >> + memcpy(led->subled_info, mc_leds[i].subled_info, >> + led->num_colors * sizeof(struct mc_subled)); ... here. CJ