From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A277C433F5 for ; Mon, 29 Nov 2021 19:07:54 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 394581F58; Mon, 29 Nov 2021 20:07:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 394581F58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1638212872; bh=Jc4NgM0RJxG09AvBWrwWc6fqASH1Iagr1AWaoky23pQ=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=c0WVTesrAKZvV/hxtkFi2rlbrdQfY9HkJ+Oms9TZG44HlZ3GaEyJEkty3ezqfoS8N 0unye9/F7ZdCvEW8Qkb98NHG+4b43g+oFCQTC00yDmhHF8YYNwwXtGZ9qR5SSMEt0O niAUeef3CWXcM8ba5JF5a+XZhhyYQcIwlu0qNa1A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C2DB6F80217; Mon, 29 Nov 2021 20:07:01 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DA36DF80240; Mon, 29 Nov 2021 20:06:50 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 44FDAF80084 for ; Mon, 29 Nov 2021 20:06:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 44FDAF80084 X-IronPort-AV: E=McAfee;i="6200,9189,10183"; a="236285548" X-IronPort-AV: E=Sophos;i="5.87,273,1631602800"; d="scan'208";a="236285548" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2021 11:06:41 -0800 X-IronPort-AV: E=Sophos;i="5.87,273,1631602800"; d="scan'208";a="458554931" Received: from smile.fi.intel.com ([10.237.72.184]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2021 11:06:38 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1mrly1-00080f-Jt; Mon, 29 Nov 2021 21:05:33 +0200 Date: Mon, 29 Nov 2021 21:05:33 +0200 From: Andy Shevchenko To: Mark Brown Subject: Re: [PATCH] ASoC: Intel: atom: Remove redundant check to simplify the code Message-ID: References: <20211125075028.8500-1-tangbin@cmss.chinamobile.com> <3ca07ce3-6d5c-20cc-8992-4700490ea472@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Cc: cezary.rojewski@intel.com, alsa-devel@alsa-project.org, Tang Bin , linux-kernel@vger.kernel.org, tiwai@suse.com, yang.jie@linux.intel.com, Pierre-Louis Bossart , liam.r.girdwood@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Mon, Nov 29, 2021 at 09:01:16PM +0200, Andy Shevchenko wrote: > On Mon, Nov 29, 2021 at 05:11:52PM +0000, Mark Brown wrote: > > On Mon, Nov 29, 2021 at 10:22:41AM -0600, Pierre-Louis Bossart wrote: > > > On 11/25/21 1:50 AM, Tang Bin wrote: > > > > > > In the function sst_platform_get_resources(), if platform_get_irq() > > > > failed, the return should not be zero, as the example in > > > > platform.c is > > > > * int irq = platform_get_irq(pdev, 0) > > > > * if (irq < 0) > > > > * return irq; > > > > So remove the redundant check to simplify the code. > > > > > Humm, it's a bit of a gray area. > > > > > the comments for platform_get_irq and platform_get_irq_optional say: > > > > > * Return: non-zero IRQ number on success, negative error number on failure. > > > > > but if you look at platform_get_irq_optional, there are two references > > > to zero being a possible return value: > > > > Zero is (or was, people were working on changing it partly due to > > confusion and partly due to moving to newer infrastructure which > > doesn't use it) a valid IRQ on some architectures. x86 wasn't one of > > those though, at least AFAIR. > > I guess it's about x86, but the API returns Linux virtual IRQ and 0 shouldn't > be among them (hardware IRQ != Linux virtual IRQ). Legacy x86 used 1:1 mapping > for ISA IRQs (lower 16) among which the Timer IRQ is 0. I believe that timer > code does not use any of those APIs (it most likely and IIRC has it hardcoded). > > Nevertheless, I have planned to make platform_irq_get_optional() to be optional > indeed, where we return 0 when there is no IRQ provided and error when it's a > real error happens. This needs to clean up the current (mis-)use of the API. Link for previous work: https://lore.kernel.org/lkml/20210331144526.19439-1-andriy.shevchenko@linux.intel.com/T/#u -- With Best Regards, Andy Shevchenko