Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp471666imm; Tue, 3 Jul 2018 23:58:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc6qc0/wum/C01qm8mOFlHm79yiqzDtkRwRG8CBL5JGCnReCWcs/6Ztp08opf0yxiBpw+/q X-Received: by 2002:a63:4106:: with SMTP id o6-v6mr779811pga.453.1530687482452; Tue, 03 Jul 2018 23:58:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530687482; cv=none; d=google.com; s=arc-20160816; b=KndQ+fjSO0hNh/+FZuu4nUBivJrxujn/thrTp639XQoxRWaMa0ypyD8vpqOTRq1AvX znhIcr3itYZP1wwhcS0Rmdve1b25/hk4it8jJFkURjThbGl175AUamcYr/MYvJBt2wj1 vvTWoEJDEeMAyzbEGpD0TeGUKZOOP9zoUnu3xb7qlpVwH0ZjjuG8iqi+ZZ/u4XLI2WAo EdMD8TbKr7aj6tKf/wxG3q+PSapnSG9wkbnqQvPhudt9BBcnIy6c1RvHzvNwKDUzpox9 pSxmtyMfzL5tmHQHl5LFtdswVQs8g8LoR0I6TmkoXMGSbzjCJm7HSPIFj+XE38bHLYj+ /35w== 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=EZajCx3wNhH1LnLjBbg4w+Sb83HX9UyztujPGOjMS1Q=; b=babnrPmxsn9BgWxE1VOvXOIxunvMaSlKH58YwN7KPyvQ6y9dOaJ5km1JLllV0x5KSK q7ICsOfKqx5ChzGiyotuEVMXqI5n5RTDhf4DrhFlJj2n+grf0ZQXWftrmbo32yOyJX0j SLQ35rZtIIwGA/smcmtxTLEsIyzbFauEGObebN2FTP4X3GSYb12uB3uwJPt1Qs5SjRnG FzIhczZ0ZRQi0qHDYGlP64jv71rEN5tm4djLs07V17WkQVyf9IpjSatO2n4smUokd2Th 2CPquNp+vILYqYmiE5AxTkG2cvYoEJOqiC1pDfLxBHeFsAjzMYbMyC4O38kxv4QgmZWc 2WDg== 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 a8-v6si2734135ple.222.2018.07.03.23.57.48; Tue, 03 Jul 2018 23:58:02 -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 S933674AbeGDG5H (ORCPT + 99 others); Wed, 4 Jul 2018 02:57:07 -0400 Received: from mail.steuer-voss.de ([85.183.69.95]:39270 "EHLO mail.steuer-voss.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932420AbeGDG5D (ORCPT ); Wed, 4 Jul 2018 02:57:03 -0400 X-Virus-Scanned: Debian amavisd-new at mail.steuer-voss.de Received: by mail.steuer-voss.de (Postfix, from userid 1000) id 3603F41CD3; Wed, 4 Jul 2018 08:56:59 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.steuer-voss.de (Postfix) with ESMTP id 2FF1541CC4; Wed, 4 Jul 2018 08:56:59 +0200 (CEST) Date: Wed, 4 Jul 2018 08:56:59 +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 Subject: Re: [PATCH v2 1/2] IIO: st_accel_i2c.c: Simplify access to driver data In-Reply-To: Message-ID: References: <1212fde5edcf360231282c9d2487712fc5b4d6f8.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 Tue, Jul 3, 2018 at 8:41 AM, Nikolaus Voss > wrote: >> Use device_get_match_data API to simplify access to driver data. > > ..._data() > > But. You actually don't use it below. It is used, see below. > >> Let acpi_device_id table entries point to the same driver data as >> of_device_id table entries and uniquify access to driver data by using >> device_get_match_data API. > >> #include >> #include >> #include > >> +#include > > (linux/property.h) > >> + match = of_device_get_match_data(&client->dev); >> + if (!match) >> + match = acpi_device_get_match_data(&client->dev); > > What I meant is to simply call > > match = device_get_match_data(...); Ok, this works, thank you. I will prepare a new patch version. This is where the match data is used: > >> + if (match) >> + strlcpy(client->name, match, sizeof(client->name)); > > In this driver, match data is used to map DT compatible strings/ ACPI CIDs to the key strings (.._ACCEL_DEV_NAME) which are used to identify the actual device (and are also used in i2c_device_id table). Niko