From patchwork Tue Jan 13 17:51:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kapileshwar Singh X-Patchwork-Id: 5623011 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3404A9F3A0 for ; Tue, 13 Jan 2015 17:51:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 37CD520573 for ; Tue, 13 Jan 2015 17:51:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42A9B20551 for ; Tue, 13 Jan 2015 17:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752840AbbAMRv2 (ORCPT ); Tue, 13 Jan 2015 12:51:28 -0500 Received: from service87.mimecast.com ([91.220.42.44]:48199 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752228AbbAMRv1 (ORCPT ); Tue, 13 Jan 2015 12:51:27 -0500 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by service87.mimecast.com; Tue, 13 Jan 2015 17:51:26 +0000 Received: from e105702-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 13 Jan 2015 17:51:26 +0000 From: Kapileshwar Singh To: linux-pm@vger.kernel.org Cc: edubezval@gmail.com, rui.zhang@intel.com, javi.merino@arm.com, punit.agrawal@arm.com Subject: [PATCH 1/2] thermal: of: Match function to pass bindparam index Date: Tue, 13 Jan 2015 17:51:21 +0000 Message-Id: <1421171482-16101-2-git-send-email-kapileshwar.singh@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1421171482-16101-1-git-send-email-kapileshwar.singh@arm.com> References: <1421171482-16101-1-git-send-email-kapileshwar.singh@arm.com> X-OriginalArrivalTime: 13 Jan 2015 17:51:26.0418 (UTC) FILETIME=[8D5F6B20:01D02F59] X-MC-Unique: 115011317512604401 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: KP Singh The match function should pass the index of the binding parameters which the cooling device needs to be matched against. There are currently no implementations of match function within the kernel. A successful match requires: trip_mask == expected_trip_mask; weight == expected_weight; binding_limits == expected_binding_limits; thermal_zone == expected_thermal_zone; Signed-off-by: Kapileshwar Singh --- drivers/thermal/thermal_core.c | 4 ++-- include/linux/thermal.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 87e0b0782023..db4d6407c1ec 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -276,7 +276,7 @@ static void bind_cdev(struct thermal_cooling_device *cdev) for (i = 0; i < tzp->num_tbps; i++) { if (tzp->tbp[i].cdev || !tzp->tbp[i].match) continue; - if (tzp->tbp[i].match(pos, cdev)) + if (tzp->tbp[i].match(pos, cdev, i)) continue; tzp->tbp[i].cdev = cdev; __bind(pos, tzp->tbp[i].trip_mask, cdev, @@ -315,7 +315,7 @@ static void bind_tz(struct thermal_zone_device *tz) for (i = 0; i < tzp->num_tbps; i++) { if (tzp->tbp[i].cdev || !tzp->tbp[i].match) continue; - if (tzp->tbp[i].match(tz, pos)) + if (tzp->tbp[i].match(tz, pos, i)) continue; tzp->tbp[i].cdev = pos; __bind(tz, tzp->tbp[i].trip_mask, pos, diff --git a/include/linux/thermal.h b/include/linux/thermal.h index fc52e307efab..dc8cf6dc59e5 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -237,7 +237,7 @@ struct thermal_bind_params { */ unsigned long *binding_limits; int (*match) (struct thermal_zone_device *tz, - struct thermal_cooling_device *cdev); + struct thermal_cooling_device *cdev, int index); }; /* Structure to define Thermal Zone parameters */