Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp601387imm; Wed, 4 Jul 2018 02:45:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc+znEsZeUt0l2I+OtqxXtBO5+BgroHQ8qR01b5HA9xI/kLgCDqng6qksgcB4DlYrUsk8Bv X-Received: by 2002:a17:902:8604:: with SMTP id f4-v6mr1401062plo.4.1530697509219; Wed, 04 Jul 2018 02:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530697509; cv=none; d=google.com; s=arc-20160816; b=ub2yGR6eeimtaPW3kgti+oW3s4IV2rRSVfIS5TV+G+Y/h3sRAkC5eMip7Eadjk98Y+ AXiqBVKPYsK9lk/ZlKpNU0WyoFHyQZArYL8NKbJ6PQQwwn21TAnDuwhBf7jpzFBTbJ6W 93hfoYHmTXP5K9/cxiGjZCAomIMJEC4dI8mMVM1T1glH07WafPpVcJ3TE9lsncqr5IJv zP8GSa7jW9WNaQclnFPLUUDua7ScuvKZ+9uEyQHP9N3kSgyBBzxQlXqK0omcUZDEmUWs tG5nHZ4UZMe6ACz/vaHz0a7vZ9Ai1HHnPhhzB6VMfS+sN3lP3cT7B+79k6wusnBmyAzE 6FKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=ObXOqyj80Br6nhkYK07mBQ347Iooqus4ZZaxSFGatyY=; b=WLyHhkrYW4+wsqOiibuJqkbrBaVAT9Z30R3ypHQ1KA9sGxikj8u0DpYKJ0O9Rab9zO 0ksr3VJLLFYnhmSGsO1qenzobbeVC4uPTjUTW8qnrw4a1JmNfRYf1byDGYrSFaL1wlB3 PqNTueJAPwczJCXVgKdCbsPnESTVsY7yqdrOlJH/RthqsIYBvg8lU9i9PQwVYOc4hTX1 zdb/i30VDrtDszYLJrccsLI+tqRvhQZE+3i51TYvjwK0K/70GBKyneI+J7FePDGhwnTQ g6vXU+7XOE6Q2t+LbbAEIHFy1Z9ohnEMy4YX6ycnjTWVvRmyGCAzz//6DdoRUfbS8NlT pe0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l184-v6si3025306pge.257.2018.07.04.02.44.55; Wed, 04 Jul 2018 02:45:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753647AbeGDJnL (ORCPT + 99 others); Wed, 4 Jul 2018 05:43:11 -0400 Received: from mail.steuer-voss.de ([85.183.69.95]:41652 "EHLO mail.steuer-voss.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932392AbeGDJmo (ORCPT ); Wed, 4 Jul 2018 05:42:44 -0400 X-Virus-Scanned: Debian amavisd-new at mail.steuer-voss.de Received: by mail.steuer-voss.de (Postfix, from userid 1000) id 42E7041AA2; Wed, 4 Jul 2018 11:42:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.steuer-voss.de (Postfix) with ESMTP id 3921A41AA1; Wed, 4 Jul 2018 11:42:40 +0200 (CEST) Date: Wed, 4 Jul 2018 11:42:40 +0200 (CEST) From: Nikolaus Voss X-X-Sender: nv@fox.voss.local To: Andy Shevchenko cc: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Lorenzo Bianconi , Linus Walleij , Xiongfeng Wang , linux-iio@vger.kernel.org, Linux Kernel Mailing List , nv@vosn.de Subject: Re: [PATCH v2 2/2] IIO: st_accel_i2c.c: Use probe_new() instead of probe() In-Reply-To: Message-ID: References: <82c6f53cfa03f9bc7c0adfc423ae65fc986a1d25.1530599660.git.nikolaus.voss@loewensteinmedical.de> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 Jul 2018, Andy Shevchenko wrote: > On Wed, Jul 4, 2018 at 12:09 PM, Nikolaus Voss > wrote: >> On Wed, 4 Jul 2018, Andy Shevchenko wrote: >>> >>> On Wed, Jul 4, 2018 at 9:37 AM, Nikolaus Voss >>> wrote: >>>> >>>> On Wed, 4 Jul 2018, Andy Shevchenko wrote: >>>>> >>>>> >>>>> On Tue, Jul 3, 2018 at 9:06 AM, Nikolaus Voss >>>>> wrote: >>>>>> >>>>>> >>>>>> struct i2c_device_id argument of probe() is not used, so use >>>>>> probe_new() >>>>>> instead. >>>>>> >>>>> >>>>> This makes... >>>>> >>>>>> MODULE_DEVICE_TABLE(i2c, st_accel_id_table); >>>>> >>>>> >>>>> >>>>> ...this table obsolete IIUC. At least that's what I did when switched >>>>> to ->probe_new() in some drivers. >>>>> >>>>> If I'm mistaken (again? :-) ) I would hear from someone to point me >>>>> how it can be used after a switch. >>>> >>>> >>>> >>>> It is still used by the i2c-core in i2c_device_match() if DT and ACPI >>>> matching fails. >>> >>> >>>> And it is used to create the corresponding modaliases for >>>> driver loading. >>> >>> >>> My question is "How?!" >>> I don't really see any points to match against it after switching to >>> ->probe_new(). >>> >>> Could you point me to the code path in i2c (or OF?) core for that? >> >> >> As written above in i2c-core-base.c: i2c_device_match() -> >> i2c_match_id(driver->id_table,... >> >> This is used for driver matching before probe() or probe_new() of the device >> driver can be called. probe_new() actually is a function signature change >> only. > > Okay, IIUC we got a match. What should we do with it? The table is not > used in ->probe_new() (in i2c core), so, you can't say which line > matched there. The table is not used by the driver, but is necessary to a) bind an i2c device declared via i2c_board_info with type field set to one of the names of the i2c_device_id table to this driver b) bind an i2c device declared via DT or ACPI but with no match in of_id/ acpi_id table but an i2c_device_id table match to this driver (fallback matching) c) create the right modaliases at compile time for this driver to make module auto-loading work in case of a) and b) Niko