Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2557133rdg; Mon, 14 Aug 2023 06:28:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHyFhGxsN2YD1T9CXJwgS/EqjzKbJKnXjXN7w0+sVwJ9AqhUXqMm4fGZsVO/zJlgCjxAJcm X-Received: by 2002:a2e:a30a:0:b0:2b6:d6e1:a191 with SMTP id l10-20020a2ea30a000000b002b6d6e1a191mr6781746lje.23.1692019694993; Mon, 14 Aug 2023 06:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692019694; cv=none; d=google.com; s=arc-20160816; b=FU1UmJ71N9RlYm1YEaGnifjyVSB/yiMjpJL6UEbSfEGhkFNwKY8rYG1mTBU82bYHR5 sL6HO2RMPjn6nvnxgE/4FqIpyJWT/YPlzX9iCQXn8cd6TtRiwFvyQqaW4+jGmMjd8Vjl 1dgt3IR3XRYxIDgtlWmlaqvCA4I1Yif73dy0hscOfPYLAGoXXgvVY0a3KmKQaFMf7AB5 tCooEYcFDB+tI4sSh/MPXL9j6K6sd4lep2+jQaH4Awa6K4xvK7wcoVFIHVPSXMt7r2rq 1uw17615n1na+yLOEXcjIyAHlqoaHsVoXn6Wq7LQVUFXPsasn6IUrFqJHtwhr/Vn+/pR k6Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=hlB2JTOczh3ErgIv2y3TBbCR5IDyH8Smv4zZbMjSUc0=; fh=PChmNaLHZJUftfZpOZcTXTFMHqBEM8qw9niqwOZQhLI=; b=SzFMHh5F9I154DEjk9atS1mOOeGfaVxCNSPD+fNZ+n2zLAiDxTi0BrOaeHargjwqFh 3QynDKJm8l+WkTsGP61UVJamG+/piQdeXNDfHyt9Hf1f5/nuW+KlfhdjR15d5n1NnN/I fN/3OC2URjWaKMlWg+mSfUqVgXGgelkdY46tw2OkTnCgDDuV6wYuZTYBbXbuskJjxYxR ilV4elsm9zjbJLZ/rSDYvnnhl25vB+Q1tePqIA8TUeK0L2EzTm8MS+exmZZBWkSVXWW0 WB2dUdJnRt7kDS/KYnxWOqSR4VTwIJOEy88hWtH0r2rZr69NsgL7VwD0+yOVVGlEnI/H iIgw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a170906558400b0099ce147d6b0si7968740ejp.823.2023.08.14.06.27.50; Mon, 14 Aug 2023 06:28:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229827AbjHNNNH convert rfc822-to-8bit (ORCPT + 99 others); Mon, 14 Aug 2023 09:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbjHNNMj (ORCPT ); Mon, 14 Aug 2023 09:12:39 -0400 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8596CE6E; Mon, 14 Aug 2023 06:12:38 -0700 (PDT) Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-d6a5207d9d8so1545802276.0; Mon, 14 Aug 2023 06:12:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692018757; x=1692623557; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hSgqut+JHlQUbB4Bd/FI8orZtwhhcAep0ucawImk8r8=; b=S6CFp9bjlVo2MLbyJ+XyKa4kUnGsop4qB3jguxwG65I7ijvj55GkO7lj0YFBY94TgC 5KZQEfRttg297W2g1DBgvNEpexbazzzhtz7UMu720mzfWBzIOS+aPxSwJqPcaniDcTiD UZ6K2QzOfviIkHcAemUNYaDE38KV7QSZ1nr/DuovwuPQsdfzksBwgqZ8tMBcB891g5Lm w+qyRkQu9e+9enT1imMPSaLg8/Y8rDT/xWx/sj9XI6PxGTp9TfpyO+3o1whfhSH/v9s4 LU+7k/wwfvPrHD9uLE99dQPF/EcxtqZBFfKH1Z6ddf2Kyv3l52fgnyepivmAo5ibj/GY MXJA== X-Gm-Message-State: AOJu0YwNels3wHdfljeccvDFY5aP4v9/zjkJegEHyHAOYS2X4nzmyqQY TER/PyD/jBAw5tjJUCua/YHcnv9x8aAgeA== X-Received: by 2002:a05:6902:149:b0:d07:b677:3349 with SMTP id p9-20020a056902014900b00d07b6773349mr10364672ybh.25.1692018757455; Mon, 14 Aug 2023 06:12:37 -0700 (PDT) Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com. [209.85.219.176]) by smtp.gmail.com with ESMTPSA id w6-20020a259bc6000000b00d06d47fd0b8sm2324160ybo.53.2023.08.14.06.12.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Aug 2023 06:12:36 -0700 (PDT) Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-d6a5207d9d8so1545745276.0; Mon, 14 Aug 2023 06:12:36 -0700 (PDT) X-Received: by 2002:a25:2d16:0:b0:d52:6882:1032 with SMTP id t22-20020a252d16000000b00d5268821032mr14671149ybt.28.1692018756289; Mon, 14 Aug 2023 06:12:36 -0700 (PDT) MIME-Version: 1.0 References: <20230805174036.129ffbc2@jic23-huawei> <20230806142950.6c409600@jic23-huawei> <20230809182551.7eca502e@jic23-huawei> In-Reply-To: From: Geert Uytterhoeven Date: Mon, 14 Aug 2023 15:12:24 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 0/4] Extend device_get_match_data() to struct bus_type To: Biju Das Cc: Andy Shevchenko , 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" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Hi Biju, On Fri, Aug 11, 2023 at 4:46 PM Biju Das wrote: > > Subject: Re: [PATCH v7 0/4] Extend device_get_match_data() to struct > > bus_type > > > > On Fri, Aug 11, 2023 at 01:27:36PM +0000, Biju Das wrote: > > > > On Thu, Aug 10, 2023 at 09:05:10AM +0000, Biju Das wrote: > > > > ... > > > > > > I'm good with this approach, but make sure you checked the whole > > > > kernel source tree for a such. > > > > > > Checking against 16 is too short I guess?? > > > > > > drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h has 18 enums. > > > > So, what does prevent us from moving that tables to use pointers? > > I think that will lead to ABI breakage(client->name vs id->name) > > match = device_get_match_data(&client->dev); > if (match) { > chip_type = (uintptr_t)match; > name = client->name; > } else if (id) { > chip_type = (enum inv_devices) > id->driver_data; > name = id->name; > } else { > return -ENOSYS; > } I don't consider that part of the ABI, as e.g. converting from board files to DT would change the name. In addition, using id->name breaks multiple instances of the same device. I applaud more unification ;-) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds