Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5816505imm; Tue, 12 Jun 2018 13:56:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJxp/Rkoh9R0AaWrSgUjEJdVMCdp1WXkAaBwUUd4HhNfy5xEcf/a3zTaL4OGhppSmRDXWHq X-Received: by 2002:a65:4607:: with SMTP id v7-v6mr1627388pgq.31.1528836988344; Tue, 12 Jun 2018 13:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528836988; cv=none; d=google.com; s=arc-20160816; b=FWPjM8B3oQy+RUKa2OWpO28E0l8bU/H+tpLmHvry9SbAhHnqWaISFh/1RX2l8ZO/fR 1E5WzC164JJBUvq46UYcsCO1piaxPCIEur9zqDbkIFKdkVSxj6OHeBwX2HhKzs1YLsVg iCQfaw2r+PuLYl72nfQ5fCcGPlpgj0blUMyGyP/Zc4vHoR+3IFnHhwm9Z5tPg9zCGSIr uLhNyfAT+CDg9uHjZHQjmpadYpU0lkN8Uj5Lbcl+n0rethkgPysxnE73Hwsp0PWWj2pL pN1YcLOWxvUaYdEQJgxsFQpoH7XQEEZh7IxlJrYJmoDqVdoMuc6n44kX8xZpSiH1WAKi Ngpg== 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 :arc-authentication-results; bh=XbWyH/RJqGwyU7SdARggc8O5trda3Xtkh/som1V+pzw=; b=mUXr6yxsofSVfqBFZWigwAy/vLBqg7iPgm0tkZRDXiOzuXzr7aUDLJPQuMiH2fVBKc zW5DoOBrI47TPvYPVtVCDHQBUhLe4a/w+vHxlHDz4lhvBQLVBBe2P8xPI1yrz9z88aw+ yW1S+gcoxBzHl0Ih26hFYO5rC4h4atpUPWKO9UQAD6UqtDMUSHBOJmZAJP5889IK4pBl cM5aQe4+GBr4DcBywwGFYyGI1sOTtLJFuCDYOYzfEgnoDS/1QzHRTQQtRUrBrfyhG5DH Uc5IgqtAOAIiMqXfMI/SCAghewoafwSB7h99qH+8+f9/vlXPnIxlyU2YZKmYxsf9WjLP JxdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YyaagYyP; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4-v6si791651pgs.476.2018.06.12.13.56.13; Tue, 12 Jun 2018 13:56:28 -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=@linaro.org header.s=google header.b=YyaagYyP; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933419AbeFLUzv (ORCPT + 99 others); Tue, 12 Jun 2018 16:55:51 -0400 Received: from mail-qt0-f181.google.com ([209.85.216.181]:44190 "EHLO mail-qt0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754102AbeFLUzt (ORCPT ); Tue, 12 Jun 2018 16:55:49 -0400 Received: by mail-qt0-f181.google.com with SMTP id l33-v6so385056qta.11 for ; Tue, 12 Jun 2018 13:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XbWyH/RJqGwyU7SdARggc8O5trda3Xtkh/som1V+pzw=; b=YyaagYyPORtc9UJ0coch5bEV7yuSQArC1dxWyi0pzKywpE9rcvnVEMvFHVQfvfn/wW jUuR/iG9Zx/yTU70M1cgc9QBU4VYluwdjKk/XF66dOWin0hG0dVeMzEPmaXcUbwkVCUS /E4wa5sbObiqV1zHtxwDTxS42ZX2JmqrPNWCs= 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=XbWyH/RJqGwyU7SdARggc8O5trda3Xtkh/som1V+pzw=; b=QhHZWr9uPeE4tN5PbQUwPkZzgvYW9DHHWUSyByc4yBclzyCSTnTqyu8dPTr3ODIJGa HvYJ+94qXh9XB0cwRsxjgoMU9OSAy6q2hyz2vZuTyjFLfKor6zCnbUYeQ8Wjd8C25Kod oUW8qZGXypS1UbKRW/zW6zUV3A1QPyapBaMUCSEG0EG/r+neDLNdGNSrqrCiM2xGgm3D GPOeno38hJsYVnohqm2id4ObGTw8WbkwoIfVue7nEMBNel1dutDi7oJjJL+4KOnMmyhG X+rOOi+vZZsYMwAKQvXVzABUzgqy3jg6A61hUoZyNoIT0EQa/HGIp+SkXduT5emxWOi7 T9KQ== X-Gm-Message-State: APt69E39OzpO7kuQMUZTFuMvmPAHARxFCVo1KVXqsQoe6OEDze8TIuBC hjSjn2UQOsPevNWQstOwMVHJMwr4JoVNyP3KCC22VQ== X-Received: by 2002:a0c:b892:: with SMTP id y18-v6mr2062010qvf.188.1528836949050; Tue, 12 Jun 2018 13:55:49 -0700 (PDT) MIME-Version: 1.0 References: <20180612194302.GP14924@minitux> In-Reply-To: <20180612194302.GP14924@minitux> From: Amit Kucheria Date: Tue, 12 Jun 2018 23:55:37 +0300 Message-ID: Subject: Re: [PATCH v2 3/5] thermal: tsens: Move 8996 get_temp() to common code for reuse To: Bjorn Andersson Cc: Linux Kernel Mailing List , Rajendra Nayak , linux-arm-msm , Eduardo Valentin , Zhang Rui , Linux PM 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 Tue, Jun 12, 2018 at 10:43 PM Bjorn Andersson wrote: > > On Tue 12 Jun 03:54 PDT 2018, Amit Kucheria wrote: > > diff --git a/drivers/thermal/qcom/tsens-8996.c b/drivers/thermal/qcom/tsens-8996.c > [..] > > static const struct tsens_ops ops_8996 = { > > .init = init_common, > > - .get_temp = get_temp_8996, > > + .get_temp = get_temp_tsens_v2, > > }; > > > > const struct tsens_data data_8996 = { > > diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c > [..] > > +int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) > > I like the function name, but it's not really common for tsens, it's > just common for tsens v2. Also as patch 4 shows we end up adding a set > of essentially empty platform specific files for referencing this > function. > I would suggest that you instead rename tsens-8996.c to tsens-v2.c, > rename ops_8996 to ops_v2 and either add new tsens_data for each > platform or simply rename that too to data_v2 which we point to from > tsens_table. I was thinking of tsens-common.c as a library of tsens functions (v1 and v2). Do you want tsens-common.c to essentially become tsens-v1.c? We'll end up with quite a bit of duplicated code in that case. IIUC what you are suggesting, we'll still need to compile in tsens-common.c even on v2 platforms. > I think we should take it once step further and add "qcom,tsens-v2" as a > valid compatible in tsens_table and make the dts do: I like that idea. > comaptible = "qcom,msm8996-tsens", "qcom,tsens-v2"; > > and > compatible = "qcom,sdm845-tsens", "qcom,tsens-v2"; > > Regards, > Bjorn