Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp713469imm; Wed, 4 Jul 2018 04:48:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeiAc8Fr9IYf5gZd8eQAkBFXjDY9mK6UKUkytCcN/4iNLtNKWgckWeXvwSW9chySx9peve4 X-Received: by 2002:a17:902:8ec9:: with SMTP id x9-v6mr1747627plo.1.1530704932359; Wed, 04 Jul 2018 04:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530704932; cv=none; d=google.com; s=arc-20160816; b=x7XC8jd9Ith15C6qjSLQ6jNlmGCvEqjMgimyAjHAWm0qyq9+wblMOHzwX4OMi7rzFK 3mr8zRUOs10QNgUM50Dx4LV6DLxRL6YcTOJmOb9bU6UDgpu/x0+dd6umVtva9rHDw7Sq NM5YHEQ9s3qfzK50cZGeO1kdVcsEn5hKjVWl0EFMWYPE0n2L+YPly0zzHXMAFQBzKjkq id6eAXRLJsFrCHRPtxp09Jonw0485e6r9gV2tiVVdVgwLKWBjnEXuratfOQ+cEY3d4sc kFnYwjjaA8RXDY3ObEfE/n/O6QcTzOI3OuYEchoMAVfPzSz5+mv9IqC4j+WSFYkaKWa8 sI0w== 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=Q22KII9/tj/X1uYD9YewtxQsRRI/UJMAgGqOBJfPPQ4=; b=WI5+vgGMdy+IEA8B5oddf2FqteRVC+wst77kCG+JidZ5fMIk5WJeGYwttqakV2dkx8 EgReijVAlvYIj6LRfoFFMSEFzr7eRNLe1UaKocnzcejlonpnANUlMg35TFgi4f5vEp1D OpizbKBhVXzjqrl9ESnDkptxW8gFt4HkAptegKzSwPiaNlAkvIrioKWOSl4617g64P38 wFng1miuqDzA1fIUSqCM1XC9CrBMLekMthCsLycaEhtQS3Uy42L3QhsRn9kosQiJsqHn 3xaa8HGTcsNU4GBzlqHbkZERFe8biRIyqkjU73DwsayxtN5yuXSAXLr+QTEhrHKfm+Ab 9Png== 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 t17-v6si3310245plo.343.2018.07.04.04.48.38; Wed, 04 Jul 2018 04:48:52 -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 S934699AbeGDLq0 (ORCPT + 99 others); Wed, 4 Jul 2018 07:46:26 -0400 Received: from mail.steuer-voss.de ([85.183.69.95]:43936 "EHLO mail.steuer-voss.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932758AbeGDLqY (ORCPT ); Wed, 4 Jul 2018 07:46:24 -0400 X-Virus-Scanned: Debian amavisd-new at mail.steuer-voss.de Received: by mail.steuer-voss.de (Postfix, from userid 1000) id 1E57441B00; Wed, 4 Jul 2018 13:46:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.steuer-voss.de (Postfix) with ESMTP id 19FB941AFB; Wed, 4 Jul 2018 13:46:19 +0200 (CEST) Date: Wed, 4 Jul 2018 13:46:19 +0200 (CEST) From: Nikolaus Voss X-X-Sender: nv@fox.voss.local To: Javier Martinez Canillas cc: Javier Martinez Canillas , Andy Shevchenko , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Lorenzo Bianconi , Linus Walleij , Xiongfeng Wang , linux-iio , 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> <10258a21-db42-2c4e-91d6-e9227e11f53b@redhat.com> 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 Hi Javier, On Wed, 4 Jul 2018, Javier Martinez Canillas wrote: > Hi Nikolaus, > > On Wed, Jul 4, 2018 at 1:15 PM, Nikolaus Voss > wrote: >> On Wed, 4 Jul 2018, Javier Martinez Canillas wrote: > > [snip] > >>> I think Nikolaus is correct, assuming that the driver can be used on >>> legacy >>> platforms that register the I2C devices using board files / platform data. >>> In that case you still need a I2C device ID table for (a) and (c) as he >>> said. >>> >>> I don't buy on (b) though, that's a bug in my opinion. If you register an >>> I2C >>> device via DT then you must have a OF device ID entry that matches the >>> device >>> and the same for ACPI. You can't rely on the I2C device table to do the >>> match. >> >> >> Ok, in my opinion it is an elegant way of not bloating the driver when no >> explicit handling (e.g. reading DT properties) is needed. Just adding an >> of_device_id doesn't change any driver functionality then but only maps to >> an already existing i2c_table_id. >> > > I disagree, in the case of OF for example a compatible string is > composed of both a vendor a device, the complete tuple is what should > be matched. > > But with the fallback, only the device portion would be used so both > and will match against the i2c device with id > "bar". It may or may not be correct but the vendor portion is very > important to disambiguate. Disambiguation via DT implies there is already a name collision in i2c modalias name space, so adding an of_id would work around this collision for DT enumeration. I2c_board_info driver binding would still be broken. The right fix would be to remove the name collision. >>> >>> I would also remove the struct i2c_device_id .driver_data fields from the >>> I2C >>> device ID table, since are not used and just makes reading the code >>> confusing >>> (only the struct i2c_device_id .name is used as far as I can see). >> >> >> Valid point, thanks. I will change that. >> >>> >>>> Javier, just a summary of the above. Nikolaus switched one driver to >>>> use ->probe_new() hook and left i2c ID table at the same time. >>>> My understanding that this table is not anymore in use. >>>> >>>> But I have to admit I didn't see entire picture of this. Can you shed a >>>> light? >>>> >>> >>> So to shed some light, in the past even {OF,ACPI}-only drivers needed an >>> I2C ID >>> table because: 1) the .probe callback had a struct i2c_device_id * >>> parameter >>> and 2) the I2C core always reported a modalias of the form i2c: even >>> for >>> devices registered via OF. >> >> >> It could have been a null pointer and device driver binding (and >> auto-loading) done just via driver.name. >> > > I'm not sure I understood this comment. What I was trying to say is that if the i2c_device_id table information was not needed (i.d. only one single id), even the old probe() could be used without defining an i2c_device_id table, the i2c_device_id* argument to probe() being a nullptr. Niko