Received: by 10.223.176.46 with SMTP id f43csp4074826wra; Tue, 23 Jan 2018 03:58:22 -0800 (PST) X-Google-Smtp-Source: AH8x226VMtV2X3e2WLYUFNDQp/zq34a5Zpb49Khz3Ch44K3VmCsakNmqPP55AVFQ3M5PkWUSrWbB X-Received: by 2002:a17:902:6a89:: with SMTP id n9-v6mr5332500plk.212.1516708702358; Tue, 23 Jan 2018 03:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516708702; cv=none; d=google.com; s=arc-20160816; b=Yvv4SUm98KKrv/GJPmKBRN21dlVviexxD6+i7GnuFl4Ajp6VIjTnQCQBLP0m41cgKT c8ROYHKeiAF3n6CPp/PZnmVECJPIPf9Y/NsJ9vkdM4weAowKJBcNQ8X8RLe+UQWfCjqQ 7rr1dL7pqHQH4ZrKXpKQ+p/gh6T5chF+d3+1RTgxYpnnvZihZYUNI97Jf/jcUY2Ie/WU zkKzWW3aRrNiqbyzmzPdSw8fWhSa6DpJzZIlocG0iqxjNswCsFGtTO2NyEzzG83bmZsR rObB+HCAvE8RhQZjbw+T5rAIpMaQ9uPH35db2MiGRUFod/7DYn5NVqbAVEZINNs4KBgb qywQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=vWiaAdHBI2P0xH+RNagt649lDd4Z5dlfqIVn7uCuVDo=; b=ANWFVu4/0iWxQPDWLHB62dTkxwT3O0+UvhfCyxKg8FGRqDIkME4CJ6q13sqESukdJG BHwwaKUYFpqoLJCWYIUkRO/jXW7In1/M5hxc330/ZGwlPagb5UK+qRBgrzmpvF8m+wIw aCzhz7ma9VGAdgB6p6lLjIjDo7z088i5H54YcDCW6lVA+jk/K1GUwpxPbBdQI6mqSdFU 91rXbi6NxJjLoQBaofoDprG5biFa5gj4yZ+E03S5HmZbk6gIMfZhj2pabqLMsqpTyYWg 5z5APZVsrmN7L5cB7G4xVO1GYz1mEOXvPxm/KsS55/J5Nubt7OO/nUa+yS4Vn9oTrt/n w1pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fllKjw5Z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si14430630pgv.317.2018.01.23.03.58.07; Tue, 23 Jan 2018 03:58:22 -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; dkim=pass header.i=@linaro.org header.s=google header.b=fllKjw5Z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751182AbeAWL5l (ORCPT + 99 others); Tue, 23 Jan 2018 06:57:41 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:33820 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751056AbeAWL5k (ORCPT ); Tue, 23 Jan 2018 06:57:40 -0500 Received: by mail-wr0-f196.google.com with SMTP id 36so286511wrh.1 for ; Tue, 23 Jan 2018 03:57:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=vWiaAdHBI2P0xH+RNagt649lDd4Z5dlfqIVn7uCuVDo=; b=fllKjw5Zt4GaAp5z4aTB57UA2vnsjUoSwUeoy1cAwGLqlVOFDOC8ShqHMOmpFV7lFb FZGXTYFhsAXWdC7oScGBVBPU0Iva0SCxIAmx21SDfHV+UT4Ytd6brhZBDgkdmPDpxwCv +RsLsX2kLJx9ZcPhV6kjWsj++XUpggr27PBek= 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:content-transfer-encoding :in-reply-to:user-agent; bh=vWiaAdHBI2P0xH+RNagt649lDd4Z5dlfqIVn7uCuVDo=; b=Fc28tikjsB8PrpftXDHEb6th+oVZs5mfTYSbVShOMFqSbuZ4k9Ab+UpQgIrOcDLq71 4KFN5WVABK9Eob7b2w1xHLr5F12HuA/BOBMMxy+KFW3QlvLhD/R3TyFEaMRigP6w/0tn 6inzi0AoZ4i48PBJ/gN8IIT3vCm99aoTrGZ99M+ugbSpj1LPtzCADjRGN88DLNlyCFt+ xzO/Ry0ONWNcoY/vAhMo+ra4fOtejp7eOf6m/psrQzaV7xuiniNs2x1eiQS2ckf+wybh TXVI0PcthkFyKSaBulc842Oszdt/g3Zcm35NH4FtZF7mPRLh+38UzfWtKnvtqVYodtva LwDg== X-Gm-Message-State: AKwxytd9yOG1oB9doXxjWQTN/4/4ds5Tk1WPJjXQZdJAPixpWGwyHXsi frGM6Tr8NIqFk5LYRoTSSeogpw== X-Received: by 10.223.150.72 with SMTP id c8mr2093440wra.225.1516708659001; Tue, 23 Jan 2018 03:57:39 -0800 (PST) Received: from dell ([2.27.167.60]) by smtp.gmail.com with ESMTPSA id l43sm275150wrc.50.2018.01.23.03.57.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2018 03:57:38 -0800 (PST) Date: Tue, 23 Jan 2018 11:57:36 +0000 From: Lee Jones To: Enric Balletbo i Serra Cc: Sebastian Reichel , Gwendal Grignou , Benson Leung , Guenter Roeck , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Sameer Nanda Subject: Re: [PATCH 3/3] mfd: cros_ec_dev: Register cros_usbpd-charger driver as a subdevice. Message-ID: <20180123115736.2ai5tjgty5ekvrd2@dell> References: <20180117175932.20636-1-enric.balletbo@collabora.com> <20180117175932.20636-4-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180117175932.20636-4-enric.balletbo@collabora.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Jan 2018, Enric Balletbo i Serra wrote: > From: Sameer Nanda > > Check whether this EC instance has USBPD host command support and > instatiate the cros_usbpd-charger driver as a subdevice in such case. > > Signed-off-by: Sameer Nanda > Signed-off-by: Enric Balletbo i Serra > --- > drivers/mfd/cros_ec_dev.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c > index 26a8731499bf..d98f03f3d251 100644 > --- a/drivers/mfd/cros_ec_dev.c > +++ b/drivers/mfd/cros_ec_dev.c > @@ -37,6 +37,9 @@ static const struct attribute_group *cros_ec_groups[] = { > &cros_ec_attr_group, > &cros_ec_lightbar_attr_group, > &cros_ec_vbc_attr_group, > +#if IS_ENABLED(CONFIG_CHARGER_CROS_USB_PD) > + &cros_usb_pd_charger_attr_group, > +#endif I'd rather not introduce #ifery into *.c files. Please find another way of doing this. Perhaps create a nil-Byte alternative that you can shove away in a header file somewhere? > NULL, > }; > > @@ -269,6 +272,24 @@ static void __remove(struct device *dev) > kfree(ec); > } > > +static const struct mfd_cell cros_usb_pd_charger_devs[] = { > + { > + .name = "cros-usb-pd-charger", > + .id = -1, What are you trying to achieve here? > + }, > +}; > + > +static void cros_ec_usb_pd_charger_register(struct cros_ec_dev *ec) > +{ > + int ret; > + > + ret = mfd_add_devices(ec->dev, 0, cros_usb_pd_charger_devs, What does 0 mean here? > + ARRAY_SIZE(cros_usb_pd_charger_devs), > + NULL, 0, NULL); > + if (ret) > + dev_err(ec->dev, "failed to add usb-pd-charger device\n"); > +} > + > static void cros_ec_sensors_register(struct cros_ec_dev *ec) > { > /* > @@ -451,6 +472,10 @@ static int ec_device_probe(struct platform_device *pdev) > if (cros_ec_debugfs_init(ec)) > dev_warn(dev, "failed to create debugfs directory\n"); > > + /* check whether this EC instance has the PD charge manager */ > + if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) > + cros_ec_usb_pd_charger_register(ec); > + > /* check whether this EC is a sensor hub. */ > if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE)) > cros_ec_sensors_register(ec); -- Lee Jones Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog