Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1248507pxb; Fri, 21 Jan 2022 13:19:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbOylgWM6ImHLeORzIJxy5000GpbaGDVJMnqeDoOL+WpQftdYcHj8jZ//+Jcl/yDUHYMk+ X-Received: by 2002:a17:902:a58c:b0:14a:d424:d9b8 with SMTP id az12-20020a170902a58c00b0014ad424d9b8mr5701857plb.117.1642799947027; Fri, 21 Jan 2022 13:19:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642799947; cv=none; d=google.com; s=arc-20160816; b=tZS1MVkohqCtTDetYfWHPCDYM/hr5WRSixHfieMr0U8VyvDFUlyxFVnwZIKLw5Aj5K qj7ljFf0s07UJ0SQH4oSFa4IlATZ0LTDowuWO00lILwNLgwVdTc587XDXYnFdcM9MI1/ 2UQrW/q+pMC98K9juyYBBQ1skw8MnYEpKGFBuwmZMH8UQX/9G0fIhnmeVRiCZt9rEvNp i9FdjvimSD1GgbOUte47IHmrW9pr4fIU2YKMLBmRE1sISaRc8wPrj9gr211+jq/iA/nG zRs9OyXBGCxoEwQuc00KvsxOuzyk1u/FChkbm0sVpQ6puxvQRtigVafCgwbFuiBSveU7 9qgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=EAldbO0fY6c4Z69F0zgy5Tqy+hJZ7FajNYzfcG8lzu8=; b=q4nOJFmclhSdeROVDBMCU8/HWdc2D70+57zc2uQ7/pt6S4qToDtvY/0hTp2CDPzczy m57YVPw4rYa1SETkgOUVWoZUzZQePIIQfkjh66s1QTWrZE0UapJ8YuZy4EdxOHvFrYY/ onV+8xkTasbESbj56WYWPhislxmjfun/0EbM6IffD4DbSMCqwLsNC/hmnKuraMk7dMRu mCno+Cb0EroyCYhPruEKjZgq78jgKfu4sED4r193ZZDFonS1d9K3Pd8irrw4yhT/0a00 bN+zExuh1ZJgj/HrgZpchmY8Ln9TROGEs/XNAeEwSS4O+1/ElIvchkQjpEym7vPcYRmR 4Ckg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lwbSqh4S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id 33si8439711pgo.767.2022.01.21.13.18.55; Fri, 21 Jan 2022 13:19:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lwbSqh4S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1376369AbiATKos (ORCPT + 99 others); Thu, 20 Jan 2022 05:44:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233816AbiATKoq (ORCPT ); Thu, 20 Jan 2022 05:44:46 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8400CC061574; Thu, 20 Jan 2022 02:44:46 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id m4so26689010edb.10; Thu, 20 Jan 2022 02:44:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EAldbO0fY6c4Z69F0zgy5Tqy+hJZ7FajNYzfcG8lzu8=; b=lwbSqh4SLeikP8AenBAz+mJgucOMFhn6+qi40XJf/wKYVo2zz5ZAGvwqwdxvEojzAI JgGkDlMK2QWP3O7fS6JLFVaM0QANG9+1PWJpwn1qDddLR6nbUUSzkVgpp54aL6uqsXgT nKJiiLtDKSTFsVaTdLH4ggrsAdzlfvEMhgS+euHv6FuknqniCl9JaTPwwnHBBNVMJtzO ls6mDoNdCFQefk9og1DtSfY5FF6RQaYeY4TNw1S9BeTTer6+QvdoX3qcyMziU/+zyMs9 03qv9y4jIaCOpa0luwW12ltRwgncoale+jJfOIgz0ePs1J86ShFDttgm7KaRLJPiH7LS Dc0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EAldbO0fY6c4Z69F0zgy5Tqy+hJZ7FajNYzfcG8lzu8=; b=W9rtgQtnXq1S6WScgFko0mwYDAUlIr1p0AITQnpZ26r78LaGAz+QV5MI/THv+e+x1t 9gk7CLwOc30Q+CLsJO7kLn916b6tMFgaSOUbGAOBSBmlkOZc5M2V4wQy5nC/06nnJBfd 30h3SmRBQZAt15zCI6zkXRxAh4muyDvQutqCmgAcTJK6nKskSDnu04Qs+N2YEIQFm7p/ B0gC1tewb+DOt5KE7ELw/H4DNoPA/jpvmEEWXPMeaLM5KqwQVxV9xzhIvV4J2fEj3fjY I63gvIHQ78ugrvpyVRMwZ7T7GDBsMoqjiFB2H3TkNhEbsJ1yexsKp1Lu6nZeitGon8SL tQBw== X-Gm-Message-State: AOAM531vBI/M5nL4skWWICKIJlkjmdfQDKDyLA3Y+4OeAg9TChrlK0kL bH6p9bryYjCm/Jo3taJ5PAqZC6yowvjVr+/3IU0= X-Received: by 2002:a05:6402:35d3:: with SMTP id z19mr20301107edc.29.1642675485050; Thu, 20 Jan 2022 02:44:45 -0800 (PST) MIME-Version: 1.0 References: <1641996862-26960-1-git-send-email-akhilrajeev@nvidia.com> <1641996862-26960-4-git-send-email-akhilrajeev@nvidia.com> In-Reply-To: From: Andy Shevchenko Date: Thu, 20 Jan 2022 12:43:02 +0200 Message-ID: Subject: Re: [PATCH v2 3/3] i2c: smbus: Use device_*() functions instead of of_*() To: Akhil R , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= Cc: Christian Koenig , Dmitry Osipenko , Greg Kroah-Hartman , Jonathan Hunter , Laxman Dewangan , linux-i2c , Linux Kernel Mailing List , linux-tegra , "Rafael J. Wysocki" , Sumit Semwal , Thierry Reding , Wolfram Sang , Len Brown , ACPI Devel Maling List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 20, 2022 at 12:29 PM Akhil R wrote: > > > ... > > > > > > This change reveals potential issue: > > > > > > > > > - irq = of_irq_get_byname(adapter->dev.of_node, "smbus_alert"); > > > > > + irq = device_irq_get_byname(adapter->dev.parent, > > "smbus_alert"); > > > > > > > > > if (irq <= 0) > > > > > > > > I guess this '= 0' part should be fixed first. > > > > > > '0' is a failure as per the documentation of of_irq_get_byname() as well as > > > of_irq_get(). The case is different for acpi_irq_get(), but it is handled in > > > fwnode_irq_get(). If I understood it right, a return value of '0' should be > > > considered a failure here. > > > > Depends. I have no idea what the original code does here. But > > returning an error or 0 from this function seems confusing to me. > > > The description in of_irq_get*() says - > /* Return: Linux IRQ number on success, or 0 on the IRQ mapping failure, or > * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case > * of any other failure. > */ > As I see from the code of fwnode_irq_get(), which is used in this case, returns > either the return value of of_irq_get() or error code from acpi_irq_get() when > it fails, or res.start if it didn't fail. I guess, any of these would not be 0 unless > there is an error. of_irq_get*() seems inconsistent... Uwe, what do you think? -- With Best Regards, Andy Shevchenko