Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1034199rdh; Mon, 25 Sep 2023 00:44:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDkF6pz+mwoMmt0H69jBoetBpYddWmksWUgv41pMnC7XjYTmBOXb4Ih7gRuiFYG3wlJd40 X-Received: by 2002:a05:6870:3126:b0:1a7:f79c:2fbc with SMTP id v38-20020a056870312600b001a7f79c2fbcmr5004098oaa.0.1695627861902; Mon, 25 Sep 2023 00:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695627861; cv=none; d=google.com; s=arc-20160816; b=MMLKrQZQUJo5wGROCUEblYnZ8J9zyfGXrk2jN7Qm3fsVEFOmzTNhlOmDbuBonl/DK8 iNbgk2SNYHtpGX1NRix4sSuJStecAMVmFDUxH+cWTqpdmD3bhNItKxBhh92Pc/0dXBhp 3/lvaXF0HxUMhtPUIUrq7qdOrQ+1+kZrQsDkiSqxkAuGiVDgjI3lf9dUXKC6+SJ8z3AD 7F3UBRFQsH3otAPx0tT3cLA6DEsvvLl6VH2AWdj+VJT0ij6rXtZi1Gom+5HBHG9Iw5j6 /mnagLj8DpwGiSJLu7IBP1AAOBqr2QN9zrj+lma42/ODeEBGH/kMWRNCekVmg0ufTnE/ J/qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=wCkXtiSuGFMPr261rqfEUV2nNoOsSqpsK2keYtPw88E=; fh=dlWaF0ouAk38l6ZadWZzGtL4PI4M8Q/efUW65rhq1u0=; b=cuBOysyoguP6Dz9FGgyUtJbWtGJ1V0FlPq8/ayJJhcJaJPA1Tn038aSh0MGprvK9Yt 8kSJObboAuZ4skaUlzfA1FhHbGClEdNBQXWI8bB2xbuZj7YC0xcNRHJWcOOXZTQIu/Yd Sx4T7ncIMNgjI4A6nwgMbbB6RPg3ypVI9QNLpCblN+Mw7UCOEDNTwXjttLIo2JIWAPlf E3/utjB6gWEdItUVXqxDEh5FIHCu9t0zYS4dlFDoGz+ITKPUAnhJFXkgXdRUOYPj89us nXyLeWQ3iPN7A5kqChqVPYCMua1neNSlTfWjBc/TMkzsOFiFYRB0rNKvPb/QKoyl+Bcv PP0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y191-20020a638ac8000000b005694b757228si9087719pgd.688.2023.09.25.00.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 00:44:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E17AC80A1868; Mon, 25 Sep 2023 00:30:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230418AbjIYHbA (ORCPT + 99 others); Mon, 25 Sep 2023 03:31:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbjIYHa7 (ORCPT ); Mon, 25 Sep 2023 03:30:59 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EC9FC2; Mon, 25 Sep 2023 00:30:53 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="412119813" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="412119813" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 00:30:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="697891983" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="697891983" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 00:30:48 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC0) (envelope-from ) id 1qkg3I-00000000HOB-1tpD; Mon, 25 Sep 2023 10:30:44 +0300 Date: Mon, 25 Sep 2023 10:30:44 +0300 From: Andy Shevchenko To: Duje =?utf-8?Q?Mihanovi=C4=87?= Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King , Alan Stern , Greg Kroah-Hartman , Linus Walleij , Bartosz Golaszewski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org Subject: Re: [PATCH RFC 1/6] ARM: pxa: Convert Spitz OHCI to GPIO descriptors Message-ID: References: <20230924-pxa-gpio-v1-0-2805b87d8894@skole.hr> <20230924-pxa-gpio-v1-1-2805b87d8894@skole.hr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230924-pxa-gpio-v1-1-2805b87d8894@skole.hr> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:30:57 -0700 (PDT) On Sun, Sep 24, 2023 at 06:42:54PM +0200, Duje Mihanović wrote: > Sharp's Spitz board still uses the legacy GPIO interface for controlling > a GPIO pin related to the USB host controller. > > Convert this function to use the new GPIO descriptor interface. ... > + pxa_ohci->usb_host = gpiod_get(&pdev->dev, "usb-host", GPIOD_OUT_LOW); > + if (IS_ERR(pxa_ohci->usb_host)) { > + dev_warn(&pdev->dev, "failed to get USB host GPIO with %d\n", > + (int) pxa_ohci->usb_host); Casting is no go in 99.9% cases in printf(), so use proper specifier. Hint: Nice looking message can be obtained by using %pe. > + pxa_ohci->usb_host = NULL; Instead, call for _optional() API. > + } ... > + if (pxa_ohci->usb_host) > + gpiod_put(pxa_ohci->usb_host); Linus, Bart, do we have misdesigned _optinal() GPIO APIs? In GPIOLIB=n, the above requires that redundant check. Shouldn't we replace gpiod_put() stub to be simply no-op? -- With Best Regards, Andy Shevchenko