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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76DC2C4332F for ; Fri, 21 Oct 2022 12:26:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229657AbiJUM03 (ORCPT ); Fri, 21 Oct 2022 08:26:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbiJUM02 (ORCPT ); Fri, 21 Oct 2022 08:26:28 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E99924C971; Fri, 21 Oct 2022 05:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666355188; x=1697891188; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=3qxDgWjz7WhDR7p1gpy2Yx6ovUUtnsHE9EkR/x054u8=; b=Bk79VNhENJtrqNCHi2pQPvEuG3LVDwx4yM0CWxT8ILPV5eCH54zzxE0e /LaZiSdpfK+LSwGzLvo7+HkrR42xpoxvhpR1hAZvQA7PKjMcr1+I1GVNb Y1uIMhmpV6wcwFoWQeIvGAknbcsXb0MeV+tqTzrl7lctTFtl9q/W6jH8i zPv7ycMFsVDyE9IvzeFn4qu0Gqx3NVh9pEn6sm1bh+2I6s6Xvqo1GmFiB o9NMU+MGiI7Zi4qPZo8ZculPerA7YEMtFfMWvjH4cZommHop0J4vBF6IA ozzXPMFNvJEkNsGQ/6/bxh3F1au5AcQlqPFRfu4hTqfLsAwdcQUIgB/ny A==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="393292249" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="393292249" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 05:26:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="630466609" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="630466609" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga002.jf.intel.com with ESMTP; 21 Oct 2022 05:26:25 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1olr6W-00B9Nk-0c; Fri, 21 Oct 2022 15:26:24 +0300 Date: Fri, 21 Oct 2022 15:26:23 +0300 From: Andy Shevchenko To: Mark Brown Cc: linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: Re: [PATCH v4 1/5] spi: pxa2xx: Respect Intel SSP type given by a property Message-ID: References: <20221020194500.10225-1-andriy.shevchenko@linux.intel.com> <20221020194500.10225-2-andriy.shevchenko@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 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org On Fri, Oct 21, 2022 at 01:16:01PM +0100, Mark Brown wrote: > On Thu, Oct 20, 2022 at 10:44:56PM +0300, Andy Shevchenko wrote: > > > Allow to set the Intel SSP type by reading the property. > > Only apply this to the known MFD enumerated devices. > > > + /* For MFD enumerated devices always ask for a property */ > > + mfd_enumerated = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); > > + if (mfd_enumerated) { > > + status = device_property_read_u32(dev, "intel,spi-pxa2xx-type", &value); > > + if (status) > > + return ERR_PTR(status); > > + } > > + > > if (pcidev) > > pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match, pcidev); > > > > match = device_get_match_data(&pdev->dev); > > if (match) > > type = (enum pxa_ssp_type)match; > > + else if (value > SSP_UNDEFINED && value < SSP_MAX) > > + type = (enum pxa_ssp_type)value; > > This is quite hard to follow, partly because value isn't exactly a clear > variable name and partly because the initialisation to SSP_UNDEFINED, > the attempt to read via device property and this if/else chain are split > up and not clearly joined up with each other. This is partly an issue > with the existing code but the extra layer of spreading things > throughout the function being added amplifies things a bit. The next patch removes the PCI part in this equation, at the end there is no "new" complexity on top of the existing one. But I'm all ears on how to simplify the existing code. -- With Best Regards, Andy Shevchenko 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 EF170C4332F for ; Fri, 21 Oct 2022 12:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=k6S4Z5JSr2CfxAbt/CxxtCP5AgtkDgHNdLmUAniELvA=; b=nndSSFzzPcxhcl 6bTFUTYj5J5XT/cVfiMlxDApqOhwFz2zkPoByVIUhS/9TtMLlPyPcsyZgBTrRagSr+0G6eDpNjOhI 5aLxmgdZv4QCrz9i3SxxuF7tkem+Ji4PtEy5Mjs2qHdeTDB4Qi+Cb9j8yVGB2zGpsJIwBc3OgQS/m jBGJdS1IaAdohAndizUX8S8xg8RU4g9FI6jbpmYiJdXu/w83DuZQkrwH3rw7uuFFBHlOPNEj4xyM2 C2sevDIeS0KeUNSCBBE04WQUUL6LG9n4dRzfAw/TJ1BTclOHto6JCk0ABsbjB6EV7Na+W5qn/kwku 6C2rA/0+BnE+dVRLQydg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olr6f-007bOh-OP; Fri, 21 Oct 2022 12:26:33 +0000 Received: from mga07.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olr6d-007bLp-IB for linux-arm-kernel@lists.infradead.org; Fri, 21 Oct 2022 12:26:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666355191; x=1697891191; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=3qxDgWjz7WhDR7p1gpy2Yx6ovUUtnsHE9EkR/x054u8=; b=nM/OJoCHzw+QpIdcmklT9q5wM9v+AlfG1LpcyFyaLOw7J/3T3p+mVPpk Fwm13igV2+3D6UPioejg8shx20KzODEtRWw/imZg/Rv60z6NKvVX51WQg z7rtngMeqOZDR1rLUB49NN6o0/S7nu64ny0BmKY9NFu2X9AbsxerUuUn5 vz8ioum+kN8PkwQYvWdafO0fZvziE1fEmglOuolCwQYUEjaBQyqo+J0Km E+D6qmXKHmCxG2rF3MUrGrNu50JNU3k0IzNHD6+8uc8c7PGYUMZIc2LO7 VSTTrMj2j+qqaF1Omq/1w/NkeFP83jewOg9OwJyGKcaAwOy4/9xZRjPW6 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="371203903" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="371203903" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 05:26:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="630466609" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="630466609" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga002.jf.intel.com with ESMTP; 21 Oct 2022 05:26:25 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1olr6W-00B9Nk-0c; Fri, 21 Oct 2022 15:26:24 +0300 Date: Fri, 21 Oct 2022 15:26:23 +0300 From: Andy Shevchenko To: Mark Brown Cc: linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: Re: [PATCH v4 1/5] spi: pxa2xx: Respect Intel SSP type given by a property Message-ID: References: <20221020194500.10225-1-andriy.shevchenko@linux.intel.com> <20221020194500.10225-2-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221021_052631_670014_2802ADC6 X-CRM114-Status: GOOD ( 22.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 21, 2022 at 01:16:01PM +0100, Mark Brown wrote: > On Thu, Oct 20, 2022 at 10:44:56PM +0300, Andy Shevchenko wrote: > > > Allow to set the Intel SSP type by reading the property. > > Only apply this to the known MFD enumerated devices. > > > + /* For MFD enumerated devices always ask for a property */ > > + mfd_enumerated = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv"); > > + if (mfd_enumerated) { > > + status = device_property_read_u32(dev, "intel,spi-pxa2xx-type", &value); > > + if (status) > > + return ERR_PTR(status); > > + } > > + > > if (pcidev) > > pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match, pcidev); > > > > match = device_get_match_data(&pdev->dev); > > if (match) > > type = (enum pxa_ssp_type)match; > > + else if (value > SSP_UNDEFINED && value < SSP_MAX) > > + type = (enum pxa_ssp_type)value; > > This is quite hard to follow, partly because value isn't exactly a clear > variable name and partly because the initialisation to SSP_UNDEFINED, > the attempt to read via device property and this if/else chain are split > up and not clearly joined up with each other. This is partly an issue > with the existing code but the extra layer of spreading things > throughout the function being added amplifies things a bit. The next patch removes the PCI part in this equation, at the end there is no "new" complexity on top of the existing one. But I'm all ears on how to simplify the existing code. -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel