Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp566377imm; Wed, 4 Jul 2018 02:01:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfr3GyqsDTRERJHIp3umwMw1fi89G1GUsz5Z0kytATXlUr1riR1m30uC8jBnLqb2E4fbOa+ X-Received: by 2002:a17:902:7892:: with SMTP id q18-v6mr1254035pll.331.1530694883750; Wed, 04 Jul 2018 02:01:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530694883; cv=none; d=google.com; s=arc-20160816; b=Af4EL3cXnogcOUVnjVBmFsAsXkB0+9wIjtepfZDlKEQotJfOsnxN1M+TM3FMEi4H8B dwfqCA5rcLNwlEqqJdJNDDljXjxpnljsP0Bhk/T2x38WRHSeMPP33L9w8Zpu581yL8BP EmKU/8yg4PPo/LBZEe79RmBT/ouszOpgtx9BMgES70M+yQ7gxrNdMjt8pAQFghQ2tlms ibTWYBVVHi+ewA/wGa8s/E9NXOrAve8x6I7PN+dtEcsnmgm2xkLEg3SqAY7yorHZOYdP hWi+r881kQDWCFbkZhmCUx/gKJizw56EsIg8+IAlT4qJ5nUsI5i236+KxT9cN73iONO4 n+dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Te9tePIeRGvCFLjYI7IVvtZylw1vtXMf4yMzFsMjlJk=; b=rBRQGSI715uWqn+oSby7JLJTsqm/bByDAF5DJZBPsAjOIy7480lizQKteDT7eRackb Bnx3fhah/tD1iazyTU+wvywJgmaFYPLlG8h5yXZGMcO9SzQ9aeTG8/7Xc2byZErg8GFh 48S3GQ6Z1NAS4HJGhVqY5+xctxKJTJ44+Ytzw5rZkHstQjAii2Jskg4p5Z2/q1nxxYJq MZuWggEvPoEFGLRpx2W/ZzcDR2Mpzn/OMgB9ihQVadPplfi7BA1Z+JkWTJxBJ6NQXtP6 WMRSlXNgk3dJRlvaA/EBi1qDQcLRXPM1STbIokNA+9vudhasUhhBkDCORIqsGR5NijKv HM6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yj854l0v; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y65-v6si2949905pgb.199.2018.07.04.02.01.08; Wed, 04 Jul 2018 02:01:23 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yj854l0v; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933407AbeGDJAa (ORCPT + 99 others); Wed, 4 Jul 2018 05:00:30 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:41401 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932376AbeGDJA2 (ORCPT ); Wed, 4 Jul 2018 05:00:28 -0400 Received: by mail-vk0-f67.google.com with SMTP id j11-v6so2685614vke.8; Wed, 04 Jul 2018 02:00:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Te9tePIeRGvCFLjYI7IVvtZylw1vtXMf4yMzFsMjlJk=; b=Yj854l0vbYccmplHXWMDtDdgN96DjawR3oh0IcmMFwZ+TYH2IrnhoMLsrT51lwY7sV bGnWZTUvq0PpByBpeHgcP5JNyVXSyXYYqioYSie2VaVLk+HSP2KhflxjJzy6TIbM8nan I14ioI+8NiW/WuikhCxlja+IlafhLkwD8/TBGpnmrX6FKRJPOCDMm2uhSN3R9VxQA2E/ 9Px0aVBWQ+zdd/c7PAL2nXl3G5vdffC34P1lB8upHVEFe1Ubl2Hze9AqFugHQd2nUHGY mbNKFV1xJphMbhpHVIs/VOHBxG0cQsxdpxrMEZ0VGcQ62n4d/vuRA4PUt22r8EuQqdfV BkAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Te9tePIeRGvCFLjYI7IVvtZylw1vtXMf4yMzFsMjlJk=; b=g4HGeIPTdknyHbo5D8OnQ3LfizDs5yd4+nF/CHQLWHfS0Kb+dBYOHwRKW8YAV4Yt1f jIge8XGNzDA0uPZCBeMcPcilV4ECgYL2st9UImxrj0LD9v9ttXKJIJxVZ7NjIj7QxNbM lMC+vyhwgyjmPH8/BglliJYEN/V7MO2WV+M90Qq4juyYn7WTQszT37WAFYGXZh9Z7lPE fU0kR6beVp5LKFASHh3RoRse/NlJQqVMLU1w3/Mwhs8pN0RQot9YfdBA67GGFS5soZrF H8zgibW37oasO3l6gmAX1AVtON+71uGk9ykfwuZVBX+DVdgKRHGgRJCEZMApU+VaZXMS uQfQ== X-Gm-Message-State: APt69E3MhhD5pYMev6W03E82xP96E7Ql20lqSG1hTpv5hn6CEKqybUUw 6gr7b9ZgFLdsRh1aQ2vDuZiS7R8ODxUcDINduzQ= X-Received: by 2002:a1f:6dc4:: with SMTP id i187-v6mr571904vkc.131.1530694826366; Wed, 04 Jul 2018 02:00:26 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:2149:0:0:0:0:0 with HTTP; Wed, 4 Jul 2018 02:00:25 -0700 (PDT) In-Reply-To: References: <1212fde5edcf360231282c9d2487712fc5b4d6f8.1530599660.git.nikolaus.voss@loewensteinmedical.de> From: Andy Shevchenko Date: Wed, 4 Jul 2018 12:00:25 +0300 Message-ID: Subject: Re: [PATCH v2 1/2] IIO: st_accel_i2c.c: Simplify access to driver data To: 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 4, 2018 at 9:56 AM, Nikolaus Voss wrote: > 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. I meant the API call you mentioned in the commit message is not used in this version and below you agree to use it eventually. >>> 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). -- With Best Regards, Andy Shevchenko