Received: by 10.213.65.68 with SMTP id h4csp592789imn; Tue, 13 Mar 2018 14:14:13 -0700 (PDT) X-Google-Smtp-Source: AG47ELvJvtqmkCDIERP4vWufxrpahLjH4cKCQsk32Qmaru6v/ZY5Hie+Ff746VUnWXK4LlPiLzcn X-Received: by 10.98.165.4 with SMTP id v4mr1935379pfm.51.1520975653329; Tue, 13 Mar 2018 14:14:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520975653; cv=none; d=google.com; s=arc-20160816; b=iJbvTrAGz73BCxFHlr1HTV1J0hV1pxBRoxoc4k7V0z7YY8/LOkEjkSf+tiQ8LBEEVQ v/uTEuwKS0+usmUPsNXiR8xEBSviKSbSJXFyOqNg8cTBNU+UQAI4HlfRqFK7nqYoe3fx rC6ESHiDTIhVWSjrmNn4TKMkrIujD7ZpHlCRV+8Vp7yYoN3zscJrIUNFbMQHHFj5fmTO e0ODhS6CTvjGEA05S33PvrCjySnVWFu79V2ngxSTRRl1iXVyoLDQRR+x/BrN7sLS5aF4 dReDPoEEEhmWMSHTzbhnW9rpz7ujeP0Nf26wA0UvsWLAw8uVflJm/sglgpq25pqhXJLf /8Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=R6W52y2DSUjxlGMl8lKrwwuTF66JTxehj0Ofq3KXH8I=; b=KVpOufaTkhXXNio1awSHOgK/voexGSETqeSTdFQrkV8X2fs4v/MZO2eGJMOHWmwBtq hHT4kvCCAuSaIeJgjCor+TECmWlvKSmEM6IeMD9P2eDSewyRUdPxc+t7dzGTnq1cl+iY SJBj+9igu3enDYYaMyxE5WBVyEOeOsKcE16d60/nBZyoT2gbEXCBWdifg06VyLa8voNw yJI2Oaa4da6YJ7uf0MCtDSjEivIaT0dPNScNlRVsXDiWdFppMzNG68FCcSH+BlZ3jl0M izcSA2SvpWmoK0PGc75O0JprHJ3h7gPUrZ8aRy/YrbB/8+i6Yc0Jr0qyi3vypUVsZeW6 T7bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ul7aetn4; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16-v6si723804pli.408.2018.03.13.14.13.58; Tue, 13 Mar 2018 14:14:13 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ul7aetn4; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752625AbeCMVNH (ORCPT + 99 others); Tue, 13 Mar 2018 17:13:07 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:45742 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752226AbeCMVNG (ORCPT ); Tue, 13 Mar 2018 17:13:06 -0400 Received: by mail-qt0-f193.google.com with SMTP id v90so1222632qte.12; Tue, 13 Mar 2018 14:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=R6W52y2DSUjxlGMl8lKrwwuTF66JTxehj0Ofq3KXH8I=; b=Ul7aetn4EfWveu6q/Fe1LNN6ysV/1Fwf1hJwLK3EFTD0vUq39otrwbBs5KYuIGff/t +UsKlEy/CdcujXz1gHjQNJWyzyeQKD7wC+1tJsSUDWHmsLEhHG6texCDvCGR4N+WEOgk DQ46G5JJg/tMyzcuACjgpH1FR5t2tbqxgOlklRm5dr8vnttdLNsMvi05w+7Dqr7WAnE7 GHSJIJf2m0FpP643ue6YVnBevdvRDdA5PBkJPoTM4GECqvIhbqm1ZJivVNDIN5Njm2cJ 0g0h84RS3qzT5qLc9JdLRs2YBCv02haU5cL02AG0Uyx69yOY7Jj8HTTRpznM/AYZ3/u4 RVlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=R6W52y2DSUjxlGMl8lKrwwuTF66JTxehj0Ofq3KXH8I=; b=Vx1YpA1dPUCu8Hf+RTEkIGHTRPi6aTjSL8+2KyhHtLpXVCtuStBPh7jmPqoImdtgAy HGcYjjw9Elv5bBPNJL2+HPFFsjWE9OkaFZ0dY/yzDj/gAKV9nFykeQjHtfKe7M0wVwtv kktAXxS7uHBOaBWFpvw2Ko3r4j2a9lrcU7GIKby0FJV4xUYJ5NOTkbTABQjC5ilj044e jiWcGnMTMBJ5TWCtRero6NVAucFV0WZZywv1mWiNBvV5Jr6h9eLgfZid5Okc8+evY1tQ ZXuiQPlIaG3BrWJsAFu86gJRBb1ChhMtvXWAos+6qejKYDdrbS1dIslZSMoXjkxtRjPK /krA== X-Gm-Message-State: AElRT7Go5AFBDlvA62R2AYENyHE/v9Ept173/VedtMQRBmF6wneU1Dyf gSmbpQlSVuFAmdTpEq6Oq07kg1U1kBsUEwKPNiI= X-Received: by 10.200.26.69 with SMTP id q5mr3293788qtk.174.1520975585076; Tue, 13 Mar 2018 14:13:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Tue, 13 Mar 2018 14:13:04 -0700 (PDT) In-Reply-To: <1520974749-5372-2-git-send-email-eajames@linux.vnet.ibm.com> References: <1520974749-5372-1-git-send-email-eajames@linux.vnet.ibm.com> <1520974749-5372-2-git-send-email-eajames@linux.vnet.ibm.com> From: Andy Shevchenko Date: Tue, 13 Mar 2018 23:13:04 +0200 Message-ID: Subject: Re: [PATCH v2 1/2] hwmon: (ucd9000) Add gpio chip interface To: Eddie James Cc: linux-hwmon@vger.kernel.org, Linux Kernel Mailing List , Jean Delvare , Guenter Roeck , Joel Stanley , Christopher Bostic , Andrew Jeffery Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > + 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. > + 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(); > + 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