Received: by 10.213.65.68 with SMTP id h4csp449697imn; Fri, 16 Mar 2018 08:07:24 -0700 (PDT) X-Google-Smtp-Source: AG47ELvG8pni45RtvBZMmTvsqLGKJ67F2zvRGlPoV5PFIVtFchhLkv4mDN2pzALvqDlmiL8WtPSf X-Received: by 10.99.126.26 with SMTP id z26mr1739948pgc.132.1521212843978; Fri, 16 Mar 2018 08:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521212843; cv=none; d=google.com; s=arc-20160816; b=TA++DAmge5QAtR1FdOrGlU+scWn2FS1rwfZf+KlZ4LcemDG4LEvPOG2V1CD5znECb+ O1pEdVH19TFaSAvzBiYpUofC+zbSiTvV+q7DCO1w+flXFKXAxIexgs34PFwz9qjtVqVu ZAuSNNJDi3Qmtf8xeei389cSPqmfUFCU1EZ5ZdgBzHCRu55+BRy2ipXJVS5rJ1ACLCy5 X5bovfOVigc2laK12hXw31kaDapClKB/9CLJyOdJB8O0L4xTudxudCnwBd5fDWDTCex3 B0y700H3WmpgPLTvTWvyLbnmeKkca+1BCAm4tc594/IqXZPqL7h5scmYDkkLNmEa2flD hQJA== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=rE4qGoFE5qdjMKHy1FT0ZrdGG91DusG+bdTnL17F1V4=; b=FspOyCxbLnPgBqY0bGntRMnZ+7hQxPqABcLdIpR6g/UeUx/SsrBmQamK/xnEY1sHSl Bndp41Z082UpPtuGuvdNBMBhyoecyIk0XgAUQ+16XzLRPOOm+oezY5f839F0sqmAOtrM 1n4tCxOIoBVcJvflco35z5If7JzQqiatv6cIYo3Tm1no/2qI819p6okRgyzh0VUfCaIa 1UAaGnfp/tWXb/T36qtpbZsUst7uHsNnPxIc4fesR88/BJ+2KvZwSN9qF1NfogKDN+M6 FoGyqnB5PmQxfjADBJq1hUYv/gThSfKywphii8pEoR2LC3CmDX36AeZA4g4UyJTf8YH8 LjeQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p10-v6si6094388plr.181.2018.03.16.08.07.05; Fri, 16 Mar 2018 08:07:23 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752942AbeCPPGB (ORCPT + 99 others); Fri, 16 Mar 2018 11:06:01 -0400 Received: from mga09.intel.com ([134.134.136.24]:36706 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752384AbeCPPGA (ORCPT ); Fri, 16 Mar 2018 11:06:00 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 08:05:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,316,1517904000"; d="scan'208";a="38573949" Received: from kuha.fi.intel.com ([10.237.72.189]) by fmsmga001.fm.intel.com with SMTP; 16 Mar 2018 08:05:56 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 16 Mar 2018 17:05:55 +0200 Date: Fri, 16 Mar 2018 17:05:55 +0200 From: Heikki Krogerus To: ShuFan Lee Cc: greg@kroah.com, linux@roeck-us.net, shufan_lee@richtek.com, cy_huang@richtek.com, jun.li@nxp.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH] staging: typec: rt1711h typec chip driver Message-ID: <20180316150555.GE11689@kuha.fi.intel.com> References: <1521191569-21221-1-git-send-email-leechu729@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1521191569-21221-1-git-send-email-leechu729@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi ShuFan, On Fri, Mar 16, 2018 at 05:12:49PM +0800, ShuFan Lee wrote: > +static int rt1711h_init_gpio(struct rt1711h_chip *chip) > +{ > + int ret; > + struct device_node *np = chip->dev->of_node; > + > + ret = of_get_named_gpio(np, "rt,intr_gpio", 0); > + if (ret < 0) { > + dev_err(chip->dev, "%s get int gpio fail(%d)\n", __func__, ret); > + return ret; > + } > + chip->irq_gpio = ret; > + > + ret = devm_gpio_request_one(chip->dev, chip->irq_gpio, GPIOF_IN, > + dev_name(chip->dev)); > + if (ret < 0) { > + dev_err(chip->dev, "%s request gpio fail(%d)\n", __func__, ret); > + return ret; > + } > + > + chip->irq = gpio_to_irq(chip->irq_gpio); > + if (chip->irq <= 0) { > + dev_err(chip->dev, "%s gpio2irq fail(%d)\n", __func__, > + chip->irq); > + return -EINVAL; > + } > + return 0; "rt,intr_gpio" should probable be "rt,intr-gpio". Then this function can be prepared for all types of platforms: static int rt1711h_init_gpio(struct rt1711h_chip *chip) { struct gpio_desc *gpio; gpio = devm_gpiod_get(chip->dev, "rt,intr", GFP_KERNEL); if (IS_ERR(gpio)) return PTR_ERR(gpio); chip->irq = gpiod_to_irq(gpio); if (chip->irq < 0) return chip->irq; return 0; } Thanks, -- heikki