Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3725imu; Wed, 2 Jan 2019 12:48:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/XbDGXRefdmW8J9C6FJNF07ibTY1y82jYCzjZ9s69+SCuduM9bBl+tTeqmcYbvx9mF6ZBWF X-Received: by 2002:aa7:8542:: with SMTP id y2mr46544495pfn.83.1546462109242; Wed, 02 Jan 2019 12:48:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546462109; cv=none; d=google.com; s=arc-20160816; b=eRkSivQBlt+tSLcHws1Bdy6Hov+6u7fuC8qWIMaPNfWtSMiloPGTFVHZykyNxdic7t Orh6RRJdGq29LJJaNQKSD8kFnAEbI6B2uLC7WVz6kcNKR6iYdvOb3XNgdDIFeXzKkpY4 r27o8ct10kXAKMTGw3+tWUyFDPxZ8rU88rFbw6VFpflMdjLkgDvPfPhLsyyW0l2N5a7j iGC/h9EGJY+UGPqRUqwRhUii9Ii+J+SUPgTRavwvRTWmrWBWi3fPLaL84xplKMnvP19g ZCOVu4YWK3DKNRsqsdkXd3mmKftHCvNck/GL29Xxaa+9kElfHrKEusgEuLcvLGxt37wv MCHg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=OuFkCJOcdTEuq0TyZdRGCNcwm9StdrV4wUpigwyzI5Y=; b=Q1LsvP5qWfEjKuQRJxlAbAUPQSZx8TmOrV16x9OOBaRervnVXXDweipXgbxn//eV9i xUtOlwNNEGFz41hQPYe8cy/utN/1ujx2q6AtAqgOXy1zgLAVldviNh1eL5BmqWjXTt8Y pbgfxcXp68xa76h4t1oiOZp8BmBRiQRo5CVEXS5v4sH0rwOmL3ccQE+cdGy8xzMbeLWE MHXeQO2EUIlsGBCGqPrwEm/8OsFpYiLiEJQqQaD4aXADhTUeeM0QxodzAY7aZmAqu7fA gYEO52+gLf17HQR1QkL+XlHMScrwZY0ZuGvTQETfIdzBtk0IaMsI+ZBC4yZdQ9ezWE0Y Ep7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c65si52817080pfa.148.2019.01.02.12.48.10; Wed, 02 Jan 2019 12:48:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727198AbfABSWU (ORCPT + 99 others); Wed, 2 Jan 2019 13:22:20 -0500 Received: from mga12.intel.com ([192.55.52.136]:36855 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725993AbfABSWU (ORCPT ); Wed, 2 Jan 2019 13:22:20 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jan 2019 10:22:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,431,1539673200"; d="scan'208";a="263909751" Received: from yoojae-mobl1.amr.corp.intel.com (HELO [10.7.153.143]) ([10.7.153.143]) by orsmga004.jf.intel.com with ESMTP; 02 Jan 2019 10:22:19 -0800 Subject: Re: [PATCH v9 08/12] mfd: intel-peci-client: Add PECI client MFD driver To: Lee Jones Cc: Rob Herring , Jean Delvare , Guenter Roeck , Mark Rutland , Joel Stanley , Andrew Jeffery , Jonathan Corbet , Greg Kroah-Hartman , Gustavo Pimentel , Kishon Vijay Abraham I , Lorenzo Pieralisi , "Darrick J . Wong" , Eric Sandeen , Arnd Bergmann , Wu Hao , Tomohiro Kusumi , "Bryant G . Ly" , Frederic Barrat , "David S . Miller" , Mauro Carvalho Chehab , Andrew Morton , Randy Dunlap , Philippe Ombredanne , Vinod Koul , Stephen Boyd , David Kershner , Uwe Kleine-Konig , Sagar Dharia , Johan Hovold , Thomas Gleixner , Juergen Gross , Cyrille Pitchen , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, openbmc@lists.ozlabs.org, James Feist , Jason M Biils , Vernon Mauery References: <20181218210417.30140-1-jae.hyun.yoo@linux.intel.com> <20181218210417.30140-9-jae.hyun.yoo@linux.intel.com> <20181221144603.GR13248@dell> From: Jae Hyun Yoo Message-ID: <8e4bcf7d-aa43-6745-2ade-9123c8d182ef@linux.intel.com> Date: Wed, 2 Jan 2019 10:22:18 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: <20181221144603.GR13248@dell> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lee, On 12/21/2018 6:46 AM, Lee Jones wrote: > On Tue, 18 Dec 2018, Jae Hyun Yoo wrote: > >> This commit adds PECI client MFD driver. >> >> >> +config MFD_INTEL_PECI_CLIENT >> + bool "Intel PECI client" >> + depends on (PECI || COMPILE_TEST) >> + select MFD_CORE >> + help >> + If you say yes to this option, support will be included for the >> + Intel PECI (Platform Environment Control Interface) client. PECI is a >> + one-wire bus interface that provides a communication channel from PECI >> + clients in Intel processors and chipset components to external >> + monitoring or control devices. > > This driver doesn't appear to actually do anything that can't be done > in a header file i.e. match some static data with a CPU ID. The child > devices can be registered by whatever registers this device. > > It seems superfluous. Why do you need it? > The main reason I added it is to provide a way for sharing the same unit address from multiple side-band function drivers that read 'reg' property setting from the parent node (this driver's node). The 'reg' property reading code is not in this driver but it will be performed in peci-core when this driver is registered using module_peci_driver(peci_client_driver), and then it will provides client->addr information for all its child node drivers. >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include > > Alphabetical. > Will fix it. Thanks! >> +enum cpu_gens { >> + CPU_GEN_HSX = 0, /* Haswell Xeon */ >> + CPU_GEN_BRX, /* Broadwell Xeon */ >> + CPU_GEN_SKX, /* Skylake Xeon */ >> +}; > > This is unused. > This is being used in 8 lines below but actually the static array can be initialized without using this enum type. Will remove it. >> +static struct mfd_cell peci_functions[] = { >> + { .name = "peci-cputemp", }, >> + { .name = "peci-dimmtemp", }, >> + /* TODO: Add additional PECI sideband functions into here */ >> +}; >> + >> +static const struct cpu_gen_info cpu_gen_info_table[] = { >> + [CPU_GEN_HSX] = { >> + .family = 6, /* Family code */ >> + .model = INTEL_FAM6_HASWELL_X, >> + .core_max = CORE_MAX_ON_HSX, >> + .chan_rank_max = CHAN_RANK_MAX_ON_HSX, >> + .dimm_idx_max = DIMM_IDX_MAX_ON_HSX }, >> + [CPU_GEN_BRX] = { >> + .family = 6, /* Family code */ >> + .model = INTEL_FAM6_BROADWELL_X, >> + .core_max = CORE_MAX_ON_BDX, >> + .chan_rank_max = CHAN_RANK_MAX_ON_BDX, >> + .dimm_idx_max = DIMM_IDX_MAX_ON_BDX }, >> + [CPU_GEN_SKX] = { >> + .family = 6, /* Family code */ >> + .model = INTEL_FAM6_SKYLAKE_X, >> + .core_max = CORE_MAX_ON_SKX, >> + .chan_rank_max = CHAN_RANK_MAX_ON_SKX, >> + .dimm_idx_max = DIMM_IDX_MAX_ON_SKX }, >> +}; >> + >> +static int peci_client_get_cpu_gen_info(struct peci_client_manager *priv) >> +{ >> + u32 cpu_id; >> + u16 family; >> + u8 model; >> + int rc; > > ret is almost ubiquitous in the kernel. Please use it instead. > Okay. Will change rc to ret. >> +static int peci_client_probe(struct peci_client *client) >> +{ >> + struct device *dev = &client->dev; >> + struct peci_client_manager *priv; >> + uint cpu_no; >> + int ret; >> + >> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); >> + if (!priv) >> + return -ENOMEM; >> + >> + dev_set_drvdata(dev, priv); >> + priv->client = client; >> + priv->dev = dev; > > If you have client (Which contains dev, you don't need dev). > Makes sense. Will remove the 'dev' member.