Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp658899imm; Wed, 4 Jul 2018 03:50:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfM8yT/+2Wmz5jSw4u4LYhozIEGKWxcLiWQPGYFgD2DREZfAWCvOzFKIkJnu8w4It8BZDOm X-Received: by 2002:a65:61a7:: with SMTP id i7-v6mr1468910pgv.219.1530701435388; Wed, 04 Jul 2018 03:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530701435; cv=none; d=google.com; s=arc-20160816; b=nxmAG/leJCDJ7NSZnZ70N+NMj4S4baIKkqASx1xRsq3jIu5LsXD4e2yHLCTHJQR52X XzhdrEKRkdCAZ3+cWAbxcvjJagz4PUHO71u/NEaoyRukwhduDILqO+jTYBYnKPE/yLkW fgY7JdqloASMPWcZ/trY58ewiitQ7s1zQdnl3EVrqAKJEnCNCxCE5x9knilF7JRJabnL KgYJnMqW7itB4uAj1/RMsDTFwpv+hWIExgCUePeKSq1iR5DsrMXsRRY2QiM+0Egp+bjf +4LZPJDYTpV7ULzb0fnv6aHhbxeGnA83YojN/ueDLdLNLcbAg6IUts8SLJkMc9aY7kpI t1CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=zXAO6NWDHhq1JFDb464xUXJv3EoS3+G4IXvjM6CjJeU=; b=K+xxRkVD69441xP+jEJoTPPgnPnnVLlEcq6QyCVK8Rhbowi9ngEuq4fXCUFYRQzKno 3NPH4FRHIcIVtvWLbWe1UwIyWhVAC55nlZE2QNsfKz9lAF7kH7Y+oOV1IVyT8Aq5NyuR 11OFHhZd5gAqYynHFVZbWW7JgmdNZh43zO89eo8KGvN6BN9rz+eEs4udPlMnl5FrXI0g Af1zqCX3DFdGyrhQwlVvfQrU+B5YmW/xEdZ+c0X8jlKBqm0H9tN3OUfHJWv1FQeEKo4b 3tr/m+T0YV+LKzdotMAuLF6e6FTdz0FRUG6WNctGSr91YNBRZy3HV886IjGVvjg2g+Lj TUYQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7-v6si3160683plt.115.2018.07.04.03.50.20; Wed, 04 Jul 2018 03:50:35 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932997AbeGDKtf (ORCPT + 99 others); Wed, 4 Jul 2018 06:49:35 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:33655 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932652AbeGDKtd (ORCPT ); Wed, 4 Jul 2018 06:49:33 -0400 Received: by mail-wr0-f193.google.com with SMTP id k7-v6so4876621wrq.0 for ; Wed, 04 Jul 2018 03:49:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zXAO6NWDHhq1JFDb464xUXJv3EoS3+G4IXvjM6CjJeU=; b=plAzWUfIezQWS2j1sveckTov6ZWMrlDICY2CE2RixUv+IG32pFsYPK1PqolcidZrUH 39lv00csHh6Nm+pvzt2pPe6KxxFWsAYgx5BiLb/dLuhVohKQBlDG3fLCg87rVDO4IInw sv0aWcE+lVqwG2kXnpanQ1XExwOwp83F29uMTSZEU6Jk/d7/IfdGnsFd5STPXkmjJP2G XAj0iRTjQgQvDUIaS7eds971b/kJ+I7vXFUnwIzdFnHcruyslJfmObBDQgKQlmA6fqgo YSWZjOCQUVf3HnvH4CeRi5b3qwP/ZdcS0J4Nh2OlamcqZolZnZOmNwB9kQu9GxuqX3hk YtrA== X-Gm-Message-State: APt69E2x511HrJgVrygYOTPG21Vx56udd4A5zgB769Kjne1iJ1QUvYsC RcymGNSdmEgBWYT3efbmCU65wQ== X-Received: by 2002:adf:e887:: with SMTP id d7-v6mr1241660wrm.43.1530701371880; Wed, 04 Jul 2018 03:49:31 -0700 (PDT) Received: from [10.201.33.7] ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id h2-v6sm2865130wmd.0.2018.07.04.03.49.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jul 2018 03:49:31 -0700 (PDT) Subject: Re: [PATCH v2 2/2] IIO: st_accel_i2c.c: Use probe_new() instead of probe() To: Andy Shevchenko , Nikolaus Voss 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 References: <82c6f53cfa03f9bc7c0adfc423ae65fc986a1d25.1530599660.git.nikolaus.voss@loewensteinmedical.de> From: Javier Martinez Canillas Message-ID: <10258a21-db42-2c4e-91d6-e9227e11f53b@redhat.com> Date: Wed, 4 Jul 2018 12:49:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On 07/04/2018 12:19 PM, Andy Shevchenko wrote: > Summon Javier to the discussion. > For my opinion he is an expert in this topic. I wouldn't call myself an expert in anything to be honest :) [snip] > >> 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) > 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. 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). > 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. The .probe_new callbacks solves (1) and the I2C core now reports of:N*T*Cfoo* solving (2). So the I2C device table isn't required anymore for {OF,ACPI}-only drivers, but it's still required for drivers that support legacy board files that calls i2c_register_board_info() directly. Same for the old .probe callback, it's needed if struct i2c_device_id .driver_data is used in the probe function. Best regards, -- Javier Martinez Canillas Software Engineer - Desktop Hardware Enablement Red Hat