Received: by 10.213.65.68 with SMTP id h4csp1181843imn; Wed, 14 Mar 2018 12:03:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELvmG0iUo2wLSXxcvO075lg0qn5on3E/kUa28zlSkmIQ4SQgkuStne91vBBla3uT3zJe/0xy X-Received: by 2002:a17:902:788e:: with SMTP id q14-v6mr5187535pll.396.1521054221498; Wed, 14 Mar 2018 12:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521054221; cv=none; d=google.com; s=arc-20160816; b=jYSi/Suw4hCpj0ZgfnSUO6mtna2quOmd0PImiiiU0b8xvIbmQYmlZ8oM29ZIx/kStc b3lgMRgxXzSKTrsnNGmP4bO5bdRHtrlfbS/petWPzYTHOfcv/pxBCdsiDQrHpfkLVgmu XMgJAFOxzDONPAfog/ENAoeehNmcsM7rev/hUfodFi6XU1UGpR4AQsm2Y/3KELuEZd2O MdTh8acf9VmnDymv/ASSxp40kjsFjMA+B5vjC+auErC1TMEduicbMsDx8zHq17KB7Q16 DFTVskYYWQYjDrF2J40SbQjEuIU/1WnlxNqC9WUHHwcbmZ4XRS8/7IxpRCyY6GEGoTaL wb7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject:arc-authentication-results; bh=y8hMHxlLANhgApaX6mDQ7WAVvXLAFs9tjiNzWzYE8vc=; b=0dwjYHyHSVbsOEQnLM0TIjF4xhHJAHnH7yyhHeEMNy4cncR7U6DBd+LcTwKgNALREP vsOCljAENfZBjxf9DeVG0RiM2t27jLNw9K+FNfDVJq4Ver1gkSViNgVEEZjH73mtvshe 7k3dAcdz54nQ73GwWFM0cXsHM9lY6uaHQfMso7E8iPjVVtPB8TPWT+vdjmSiynAC49GI /oXXmGJF5wvm0LWlFTfiKjH6A8C18eL8EadLyV79xcj32uPD/LOw5hF+WVAQC528LKPG /bqK8IcqNkv4a0ocW2e2LplGvGLHptgTKlNQlYqlbXLDxnyC5z1Su7hcWOCC8Q0qFpm9 BXlA== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4si2238104pgt.733.2018.03.14.12.03.08; Wed, 14 Mar 2018 12:03:41 -0700 (PDT) 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751871AbeCNTBm (ORCPT + 99 others); Wed, 14 Mar 2018 15:01:42 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57086 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751467AbeCNTBl (ORCPT ); Wed, 14 Mar 2018 15:01:41 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2EJ16i0061915 for ; Wed, 14 Mar 2018 15:01:40 -0400 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gq5bd3kgv-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 14 Mar 2018 15:01:39 -0400 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 14 Mar 2018 13:01:38 -0600 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 14 Mar 2018 13:01:35 -0600 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2EJ1ZS612124668; Wed, 14 Mar 2018 12:01:35 -0700 Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 06F77C6043; Wed, 14 Mar 2018 13:01:35 -0600 (MDT) Received: from [9.41.241.240] (unknown [9.41.241.240]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP id 6FD2CC6047; Wed, 14 Mar 2018 13:01:34 -0600 (MDT) Subject: Re: [PATCH v2 1/2] hwmon: (ucd9000) Add gpio chip interface To: Guenter Roeck , Andy Shevchenko Cc: linux-hwmon@vger.kernel.org, Linux Kernel Mailing List , Jean Delvare , Joel Stanley , Christopher Bostic , Andrew Jeffery References: <1520974749-5372-1-git-send-email-eajames@linux.vnet.ibm.com> <1520974749-5372-2-git-send-email-eajames@linux.vnet.ibm.com> <20180314185542.GA23989@roeck-us.net> From: Eddie James Date: Wed, 14 Mar 2018 14:01:34 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180314185542.GA23989@roeck-us.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18031419-8235-0000-0000-00000D29593C X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008674; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.01003037; UDB=6.00510431; IPR=6.00782367; MB=3.00020035; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-14 19:01:38 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031419-8236-0000-0000-0000400FB6FA Message-Id: <2e301c07-8880-0821-0549-9c52f5fb35f5@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-14_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803140207 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/14/2018 01:55 PM, Guenter Roeck wrote: > On Tue, Mar 13, 2018 at 11:13:04PM +0200, Andy Shevchenko wrote: >> On Tue, Mar 13, 2018 at 10:59 PM, Eddie James >> wrote: >>> From: Christopher Bostic >>> >>> Add a struct gpio_chip and define some methods so that this device's >>> I/O can be accessed via /sys/class/gpio. >>> + /* >>> + * Note: >>> + * >>> + * Pinmux support has not been added to the new gpio_chip. >>> + * This support should be added when possible given the mux >>> + * behavior of these IO devices. >>> + */ >>> + data->gpio.label = (const char *)&client->name; >> Hmm... Why do you need this casting? >> >>> + data->gpio.get_direction = ucd9000_gpio_get_direction; >>> + data->gpio.direction_input = ucd9000_gpio_direction_input; >>> + data->gpio.direction_output = ucd9000_gpio_direction_output; >>> + data->gpio.get = ucd9000_gpio_get; >>> + data->gpio.set = ucd9000_gpio_set; >>> + data->gpio.can_sleep = 1; >> Isn't it type of boolean? >> > You are right. > >>> + data->gpio.base = -1; >>> + data->gpio.parent = &client->dev; >>> + data->gpio.owner = THIS_MODULE; >>> + data->gpio.of_node = client->dev.of_node; >> I think GPIO core does this for you. >> > Same here. I checked and found that it also sets the owner, so maybe this can be > dropped as well. Ah true. Especially since there is a TODO: remove chip->owner in the core. > >>> + if (data->gpio.ngpio) { >> Hmm... >> >> I would rather reorganize the above part to a separate helper, like >> >> static int ..._probe_gpio() >> { >> ... >> switch () { >> default: >> return 0; /* GPIO part is optional */ >> } >> return 0; >> } >> >> ret = _probe_gpio(); >> if (ret) >> dev_warn(); >> > I am neutral to positiva on that. > Might as well add the call to devm_gpiochip_add_data() > into that function as well. Sure. I can do a v4. Thanks, Eddie > >>> + ret = devm_gpiochip_add_data(&client->dev, &data->gpio, >>> + client); >>> + if (ret) >>> + dev_warn(&client->dev, "Could not add gpiochip: %d\n", >>> + ret); >>> + } >>> + >>> return pmbus_do_probe(client, mid, info); >>> } >>> >>> -- >>> 1.8.3.1 >>> >> >> >> -- >> With Best Regards, >> Andy Shevchenko