Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2545378ybm; Thu, 23 May 2019 19:50:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9SZXrJmDOebKNIzNbR22Fptk3t0mJdTZR6YobolGp3cpBTNxtmBY+ELcG+HC1QZOSoI4Z X-Received: by 2002:a62:51c2:: with SMTP id f185mr48582437pfb.16.1558666253124; Thu, 23 May 2019 19:50:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558666253; cv=none; d=google.com; s=arc-20160816; b=H6LuM1UURSur+ZOW5myeCRN4KNbJ3NqSwYn7vORXtRPFobsgOLxs6o4Vlkk6MG3zIP jQUibVUG6V4m20QUrjhnpcoFOlHFVk5aKaNhvdzKlU9Lqgb3BQGG/2YZ0+gW/XbU53VG BibafYVABviVC8S3LmgC7/WqoDOtO73gWyN7x2MnE3fjTmz2pfoPLzlk6cjy0I7YSyam 0j4dzgUZUDs1Kg1aJLjNUhH3jH7Zq6RuS9SJaKL5p1XnLuIA9CVM5ukUGLNmU0UXEra7 Vhr+9AQSxV5GXEy1pPfXrPXE5NcE3e6+j53AC7TDaRHT8NejA37CtTC4R/Kaya0wtmji QOEA== 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 :in-reply-to:references:mime-version:dkim-signature; bh=vAHtKv7wiLYKCEkr3cbu7GfPBp0LIuyfDvpGOBSxNWk=; b=oiYYjw1KJ/zgLW7HLNGwb/rVn6ahoSvHgbw2ByUS7voAR28dSAXkXgz6O/ffE6CrCE GdQfSMsHklDcyYKAcEYlh1I4otdyMlc71Y3Rwk6JjuTuKpu+cLp148LGYXl16pQiYrFK AXBePBYqWdsaYVN2DakV+3Zcl4u0sN3tFjjp2kRCqy/+kvDbw8ohHP/TAuoQ3qFejjIB uk5GUGYMXWDOONQLlzwTyZ0KlqTuH1ydKUiVnfAzSiWSYt852xyhDbb73huahgHVXSts adci7kq0X+TTxrLRBNF1EcWI3XpWxQlJVyn8owgj3/rFFBXy1s5kxcRufl00cOETkhHw x0vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sur0YmTe; 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 g17si2225889pgk.500.2019.05.23.19.50.32; Thu, 23 May 2019 19:50:53 -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=sur0YmTe; 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 S2387732AbfEXCtI (ORCPT + 99 others); Thu, 23 May 2019 22:49:08 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:38817 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731522AbfEXCtI (ORCPT ); Thu, 23 May 2019 22:49:08 -0400 Received: by mail-it1-f193.google.com with SMTP id i63so11620169ita.3; Thu, 23 May 2019 19:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vAHtKv7wiLYKCEkr3cbu7GfPBp0LIuyfDvpGOBSxNWk=; b=sur0YmTeovQti6f+AxK9Ntb6kmiFaT9IX63hBoQV00faFSDOuK1HOuBze6dvotY5JS Z5cAOtAwaP+kS3d+s9fovemAxpiHNkCFatZeuDR2M9TiJ7twl2h4RUh68UQVv5fq7GmK oUkkolyLu4jYtDUfmD4w/+nP9Cpql2HU8gbzb3q/STkzEP3rza9UKmBCq7pBeiR2pe46 0JX57ix+ZO1BS5Z8iofremcSZdCi2FR+ZKva2cVtOkhMa6Nn0yHjOh4z9cutw8jDto3n IutztA+08cWmqH8IYR5pAs3Tui+DtuAiBX8dBC+nk4XiW4pBJkzhp5GHL48YLsTY3Opa IF4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vAHtKv7wiLYKCEkr3cbu7GfPBp0LIuyfDvpGOBSxNWk=; b=XPBkg0gHlYthpD37sH0ni06HJAHxxoOdHK8IXl5SAU95MKF3LDE+fIbe0es5RDftea 9bEorU0WjM4R5Zc9DxbEHF2v4RGMqZ7z1SryQCKeCngAiE/tDDu6RxNQpXKDlCwrP/Ti FvVfOw1R66PTTI/tmAxEokWzXJDzix9FRBIggY+/3xI+ajluYu1277lH8pAOwey9/lX1 9RljOED6+kPl4DL88TsKkbaONClcVcrr3ztZjbYXHM3iuANUCG+UlM0jKM5xEAK2WR2H MJuQ8jrrxskz2MpJM6QZ3CcEsUfSf+yrZ0YGHJQ4+IYtZY5y82O1TK3lEnSw7r0by7VI JOzQ== X-Gm-Message-State: APjAAAUALf9gcVvApmZP7g2zQGJmEy46B9J70fQIpPJdmd+9PJdtsEdL ieqrDA7+jQM2bEGIm1ZOYPtHTZaF9s19jFTb4AY= X-Received: by 2002:a05:6638:233:: with SMTP id f19mr4106816jaq.24.1558666147485; Thu, 23 May 2019 19:49:07 -0700 (PDT) MIME-Version: 1.0 References: <20190416172203.4679-1-daniel.lezcano@linaro.org> <20190423154430.GA16014@localhost.localdomain> In-Reply-To: From: Andrey Smirnov Date: Thu, 23 May 2019 19:48:56 -0700 Message-ID: Subject: Re: [PATCH] thermal/drivers/of: Add a get_temp_id callback function To: Daniel Lezcano Cc: Eduardo Valentin , Zhang Rui , linux-kernel , Linux PM list , Chris Healy 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 Mon, Apr 29, 2019 at 9:51 AM Daniel Lezcano wrote: > > On 24/04/2019 01:08, Daniel Lezcano wrote: > > On 23/04/2019 17:44, Eduardo Valentin wrote: > >> Hello, > >> > >> On Tue, Apr 16, 2019 at 07:22:03PM +0200, Daniel Lezcano wrote: > >>> Currently when we register a sensor, we specify the sensor id and a data > >>> pointer to be passed when the get_temp function is called. However the > >>> sensor_id is not passed to the get_temp callback forcing the driver to > >>> do extra allocation and adding back pointer to find out from the sensor > >>> information the driver data and then back to the sensor id. > >>> > >>> Add a new callback get_temp_id() which will be called if set. It will > >>> call the get_temp_id() with the sensor id. > >>> > >>> That will be more consistent with the registering function. > >> > >> I still do not understand why we need to have a get_id callback. > >> The use cases I have seen so far, which I have been intentionally rejecting, are > >> mainly solvable by creating other compatible entries. And really, if you > >> have, say a bandgap, chip that supports multiple sensors, but on > >> SoC version A it has 5 sensors, and on SoC version B it has only 4, > >> or on SoC version C, it has 5 but they are either logially located > >> in different places (gpu vs iva regions), these are all cases in which > >> you want a different compatible! > >> > >> Do you mind sharing why you need a get sensor id callback? > > > > It is not a get sensor id callback, it is a get_temp callback which pass > > the sensor id. > > > > See in the different drivers, it is a common pattern there is a > > structure for the driver, then a structure for the sensor. When the > > get_temp is called, the callback needs info from the sensor structure > > and from the driver structure, so a back pointer to the driver structure > > is added in the sensor structure. > > Hi Eduardo, > > does the explanation clarifies the purpose of this change? > Eduardo, did you ever have a chance to revisit this thread? I would really like to make some progress on this one to unblock my i.MX8MQ hwmon series. Thanks, Andrey Smirnov