Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp1280478rwl; Thu, 10 Aug 2023 08:55:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHcx1qzZtQxNi/Iv0VJ7tAlx2j8XZZLeXsnjRYrvgjmoTVkb3aWSqtUEHg2WJxf0QBm0rq0 X-Received: by 2002:a05:6a00:1943:b0:687:5763:ef27 with SMTP id s3-20020a056a00194300b006875763ef27mr3582692pfk.33.1691682947910; Thu, 10 Aug 2023 08:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691682947; cv=none; d=google.com; s=arc-20160816; b=NRTlbojFglCvocUejMQqpjcYvQ0jlPHS+0YEHCK/VZxi2ZbYYUaoRxdKrR9FwWvaUu 0uL8qesbDKhXQtr1dasHQEMch2cJqOt7EWbJfcS8bPaBZi1g679S79IvKzyyvWl3HLkO 3S91PIkpqzEE+3gCnLF4CJMPnIk8/v9Oo754nRKDiPeVRVF1uJJa8zvTmH4SGCZtfWw7 ITcMHYXhWjYFQkPPt4+8Wu1xVGzCkIbZk36GR5vvxrg/v8SK889GKbvwOGlCxfAWyGBH nrpPaHoxEOurt1dmvaYego3Sr4FRnQ8q3k6tV4b8SYph1hYMQeOiCudyspdh/T8A5rbq x1/A== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=TrCkrUFindmWo5nVYu62zsmf+UUhyuRRH0Nlb06mpkc=; fh=+8iAtIeO4vQNEPpCDTGWyBQv2eam1tGQ/YB/woiZDes=; b=RE3PeYg1dFnD6thbjudO5pBro1a3DLDz9VmPlLsiCDyrd9KZlTSbe+9VQKRFceZu2G G9Hmfwttxx6zU8g8lgp/70xlQ8kE00zANV7hvbV0wZB0cbUapbGASkH7F4OStJDVRQIK EWXOBag5HE8wQnqKfG8znKsnZWe01d37h4sBMshwz5k/+MPBzBSNNTmOlSasxD9JtavB rBXRyIYidecRQR/2GAk5XX2I/VXESuHBEM5wKycWfRo0+IAFePR4brePYyinj12iDTKx w9xQ9At0t0j+rx+B2eUJVIBG+/c8uCS0ROEdEd2NRKgLnnWlpZwk01LwWs1RfPrpmlRA R6hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C4GWCdmH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y31-20020a056a00181f00b006821425440bsi1780251pfa.279.2023.08.10.08.55.35; Thu, 10 Aug 2023 08:55:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C4GWCdmH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234146AbjHJPMI (ORCPT + 99 others); Thu, 10 Aug 2023 11:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230505AbjHJPMH (ORCPT ); Thu, 10 Aug 2023 11:12:07 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F58D26A6; Thu, 10 Aug 2023 08:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691680326; x=1723216326; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=PoPLH6q9kFPcmdWUSyqja114zqyQiVZBg03NQdgbgJA=; b=C4GWCdmHECke++9Bf7GWK6BC/DTCegWyp5Tn9PSpngIBpzPpt+fPwwp+ 0Ni3SxVV1Pv+qpRCFEzXh/ihtgjcTFbdCp8SzI1ZQLZQvPtofWOM9hZnq Hyl/ti1G0HLcZa35cqTFkLYQddYiHbWEXvhCHvzFhRu6vv36hRKEEZZgN EBMW+JTxj1HtzUMQoGqCwBw6eY5eCw4wFGgqnZ7/tlwcYAGFsscH5Y8fq 9jQ9ytULTHHMuxQ4hcd8HUTUP9RwSaampdU4uISAYfLvq8W8lGSawNFfl idX/DM8fv3rbNTcQbGdPH9XpC6Rt+mKkzhLn4ok94PDkWTWgEkc8ISYFK w==; X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="361565741" X-IronPort-AV: E=Sophos;i="6.01,162,1684825200"; d="scan'208";a="361565741" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2023 08:11:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="797644555" X-IronPort-AV: E=Sophos;i="6.01,162,1684825200"; d="scan'208";a="797644555" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga008.fm.intel.com with ESMTP; 10 Aug 2023 08:11:51 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qU7KH-006JF1-1j; Thu, 10 Aug 2023 18:11:49 +0300 Date: Thu, 10 Aug 2023 18:11:49 +0300 From: Andy Shevchenko To: Biju Das Cc: Jonathan Cameron , "linux-kernel@vger.kernel.org" , Peter Rosin , Dmitry Torokhov , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , Alexandre Belloni , "Rafael J. Wysocki" , "linux-acpi@vger.kernel.org" , Andi Shyti , Wolfram Sang , Geert Uytterhoeven , "linux-rtc@vger.kernel.org" , "linux-iio@vger.kernel.org" , "linux-i2c@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" Subject: Re: [PATCH v7 0/4] Extend device_get_match_data() to struct bus_type Message-ID: References: <20230804161728.394920-1-biju.das.jz@bp.renesas.com> <20230805174036.129ffbc2@jic23-huawei> <20230806142950.6c409600@jic23-huawei> <20230809182551.7eca502e@jic23-huawei> 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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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 On Thu, Aug 10, 2023 at 09:05:10AM +0000, Biju Das wrote: > > On Tue, 8 Aug 2023 15:18:52 +0300 > > Andy Shevchenko wrote: > > > On Mon, Aug 07, 2023 at 01:37:12PM -0700, Dmitry Torokhov wrote: > > > > On Mon, Aug 07, 2023 at 05:54:07PM +0300, Andy Shevchenko wrote: ... > > > > So in legacy ID lookup path we can safely assume that values below > > > > 4096 are scalars and return NULL from the new > > > > device_get_match_data(). This way current drivers using the values > > > > as indices or doing direct comparisons against them can continue > > > > doing manual look up and using them as they see fit. And we can > > convert the drivers at our leisure. > > > > > > It's a good idea, but I believe will be received as hack. > > > But why not to try? We indeed have an error pointers for the last page > > > and NULL (which is only up to 16 IIRC) and reserved space in the first > > > page. To be more robust I would check all enums that are being used in > > > I2C ID tables for maximum value and if that is less than 16, use > > > ZERO_OR_NULL_PTR() instead of custom stuff. > > > > > See iio/adc/max1363 example that has 37ish. > > > > Could tidy that one up first and hopefully not find any others that are in > > subsystems not keen on the move away from enums. > > If there is no objection, I can fix this using i2c_get_match_data() for > iio/adc/max1363 and device_match_data() will return ZERO_OR_NULL_PTR() > if max enum ID in the ID lookup table is less than 16. And the drivers > that use legacy ID's will fallback to ID lookup. So that there won't be > any regression. I'm good with this approach, but make sure you checked the whole kernel source tree for a such. -- With Best Regards, Andy Shevchenko