Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3875390imm; Sat, 21 Jul 2018 05:17:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpejMOeDulHqAxvikPs6sh7soa4xdEo+uclhI9loBI7G9EOkF11cK1YzmJhZJf05htA+tDjE X-Received: by 2002:a63:65c2:: with SMTP id z185-v6mr5389049pgb.276.1532175450791; Sat, 21 Jul 2018 05:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532175450; cv=none; d=google.com; s=arc-20160816; b=k5Jh5M+W+R89154Dy1OKufRuFPpGiTBdZrWWr03Zdqu9vkfdh129V/s8RmvTq3oO+L Sz+WY1w8pmbxzjbXc6+GoLimrOv53z1w5t/O8wkuiejvMqRpFfsr0/xgwEWqmH8cxLvV 4dNGkut2nKndn2cwzzYkLKIYb2boWvkpw0ZvFsxnY1ggC337E9f7KYrsMJc8V36hYIuu ETLxZ7PES8yXOX4yWTWnDxaPlxSqCeyO6bVUlEF9CBNJRPRuICgdaplFFkvt8Y5of00k /bof3wxmKmhhK9J/RAKsOgmkesoBVizGFqF7fo1GEYrEn2F1xSfT74gIalbUIcg0TrQU Fnow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=5JqCZVyEGL3VUIeNxjcTtNpdU6BNr5k4ixiARd+y7iM=; b=GF6G9g3AGVnw0qfueOxZrboES7a7pJbvIe5qzGZ2ngvcy3nlRP8zBDN9i22N/BoDTT Q9XQQBWP30wMite1OBonZuIBWMQynnmKHg1b6vgFbxzbEjv7OQKEz1d29EkHcQ6iXXEH C3ijqcVd3K3qk5tcB7+2R7JgnDCMhXxD8mNvUa0NwA/hVwi5Xk/HLMRlpM6LPAFItYVr CHomWUOYi2Ol8PmeTtsf4qShh1P6YuYdCwhk9ZcyOVJ7cUXT+hWvBabkFCBthdmkyP3t Opp/G8FEEbo5TJWTyYjR9xaNmDgYBegl0DuRQuavIpuiIQTeUTxGvZImlHk375HTpivf H3PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iJRh3Vv4; 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 k11-v6si3718375pgm.154.2018.07.21.05.17.03; Sat, 21 Jul 2018 05:17:30 -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=iJRh3Vv4; 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 S1727663AbeGUNIM (ORCPT + 99 others); Sat, 21 Jul 2018 09:08:12 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36614 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727518AbeGUNIM (ORCPT ); Sat, 21 Jul 2018 09:08:12 -0400 Received: by mail-ed1-f68.google.com with SMTP id t3-v6so11805671eds.3; Sat, 21 Jul 2018 05:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5JqCZVyEGL3VUIeNxjcTtNpdU6BNr5k4ixiARd+y7iM=; b=iJRh3Vv4ZaxFKoyIPdOBhJjME5wcPDRl86MeeMJwpGp9Z/ActLobS5Dj4RVhWm7KFD n4Y+st/VfYCAwF7Xj/PhCizi+UC2IjupZTaBxPFidCmjyKEITWd9Bd//gjCoDDUjYOKv mMpZcGPZgGHvf36rGcgC/r1yDRxVX3g9P0LKurLWvPWm9kemP/peN06MgjjfIf60M3Ql 7GkUNIs1bO/enXkJwvy2EFxdOIb5wuU9kB6v15AF4C6DGWwCEfA8x0b5KbkTWeP2gfAu +R9FZEqzVeZgDgF7Ex5t5b8vGS6mGZAKCzQVu9e6k5DUyoKdMoc2APY413snOb1djHVM 5L2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5JqCZVyEGL3VUIeNxjcTtNpdU6BNr5k4ixiARd+y7iM=; b=p26JQiRs7h9gcvnczsYG7eT+fhgwKggL0Ah/9hoEr8wUhLvFC8tfBJ3Dv53W463Suz fHgTNxbvHDWoBc43SqqKZ8N6KzCPxywGUtGufY6+9+12/eQqRyTODi5045gQ4IgNs9yB gw11Bx2H872dXabA9/UQbZAY8EM74hPYKRAl/xRLC+oQoSZGLA7aiDHwwJEO4AzwtEXV eSAfwW2y/Adq0ewrDWlwn8+WoiQ6x9ZkT/tJFU87hKH5ZoB+03SzYlHe1He1rmEH5AHN P6yAWQne9z6L/o2le0CTERu4fuvDYNx8Bz+5RzM4GAw0CIrp28of8mk/D8yeyb9YoNGq oBrg== X-Gm-Message-State: AOUpUlE+uoaBuXYKuD1AWd1A6E5r3YS9CVJaLJV8pHJ/Ta8TQ/0rS+ZR /dDdmvuWkSC1Xq5mxf8YuoM= X-Received: by 2002:aa7:c0c9:: with SMTP id j9-v6mr6520971edp.135.1532175338986; Sat, 21 Jul 2018 05:15:38 -0700 (PDT) Received: from dimapc.localnet (109-252-90-13.nat.spd-mgts.ru. [109.252.90.13]) by smtp.gmail.com with ESMTPSA id i10-v6sm2585774edk.56.2018.07.21.05.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Jul 2018 05:15:38 -0700 (PDT) From: Dmitry Osipenko To: Marcel Ziswiler , "broonie@kernel.org" Cc: "linux-kernel@vger.kernel.org" , "jonathanh@nvidia.com" , "thierry.reding@gmail.com" , "tiwai@suse.com" , "lgirdwood@gmail.com" , "perex@perex.cz" , "linux-tegra@vger.kernel.org" , "alsa-devel@alsa-project.org" Subject: Re: [PATCH 2/2] ASoC: tegra: probe deferral error reporting Date: Sat, 21 Jul 2018 15:15:37 +0300 Message-ID: <102145026.ENfUlVqMES@dimapc> In-Reply-To: <2195096.d8yV6ZqeS2@dimapc> References: <20180720080424.31505-1-marcel@ziswiler.com> <1532174119.19673.24.camel@toradex.com> <2195096.d8yV6ZqeS2@dimapc> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Saturday, 21 July 2018 15:03:57 MSK Dmitry Osipenko wrote: > On Saturday, 21 July 2018 14:55:21 MSK Marcel Ziswiler wrote: > > On Sat, 2018-07-21 at 14:17 +0300, Dmitry Osipenko wrote: > > > On Saturday, 21 July 2018 12:56:15 MSK Mark Brown wrote: > > > > On Fri, Jul 20, 2018 at 12:31:07PM +0000, Marcel Ziswiler wrote: > > > > > On Fri, 2018-07-20 at 13:16 +0100, Mark Brown wrote: > > > > > > > ac97->sync_gpio = of_get_named_gpio(pdev- > > > > > > > > > > > > > > > >dev.of_node, > > > > > > > > > > > > > > > "nvidia,codec- > > > > > > > > > > > > > > sync- > > > > > > > > > > > > > > gpio", 0); > > > > > > > > > > > > > > if (!gpio_is_valid(ac97->sync_gpio)) { > > > > > > > > > > > > > > - dev_err(&pdev->dev, "no codec-sync GPIO > > > > > > > supplied\n"); > > > > > > > + ret = ac97->sync_gpio; > > > > > > > + dev_err(&pdev->dev, "no codec-sync GPIO > > > > > > > supplied: > > > > > > > %d\n", ret); > > > > > > > > > > > > > > goto err_clk_put; > > > > > > > > > > > > > > } > > > > > > > > > > > > This isn't reporting an error code associated with the attempt > > > > > > to > > > > > > find a > > > > > > codec-sync GPIO, it's the result of some other operation. > > > > > > > > > > What exactly is then the of_get_named_gpio() above please doing > > > > > if > > > > > not getting the codec sync GPIO? I am not following you, sorry. > > > > > > > > It's not in any way involved in setting the value of ret, whatever > > > > value > > > > that has it's nothing to do with that operation. > > > > > > The comment to gpio_is_valid() says that it "Returns GPIO number to > > > use with > > > Linux generic GPIO API, or one of the errno value on the error > > > condition". > > > Comment doesn't explicitly states that the returned GPIO number is > > > always > > > valid, but it is kinda implied. > > > > Do you mean I should be assigning the return value of gpio_is_valid() > > to ret and use that instead? > > No, gpio_is_valid() returns a boolean. I think your patch is fine as it is > is. > > Probably Mark meant something like this: > > ac97->sync_gpio = of_get_named_gpio(pdev->dev.of_node, > "nvidia,codec-sync-gpio", 0); > if (ac97->sync_gpio < 0) { > ret = ac97->sync_gpio; > dev_err(&pdev->dev, "no codec-sync GPIO supplied: %d\n", > ret); goto err_clk_put; > } > > if (!gpio_is_valid(ac97->sync_gpio)) { > ret = -EINVAL; > goto err_clk_put; > } > > But that is not needed because of_get_named_gpio() returns either a valid > GPIO number or a error code. Also note that tegra20_ac97 code doesn't check the returned value of: gpio_request(workdata->sync_gpio, "codec-sync"); That is a bit fragile. Probably would be better to move the GPIO requesting to the drivers probe function using the devm_gpio_request_one() and fail the driver probing if requesting fails. That should be a distinct patch if you'll want to implement that.