From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752208AbcFJG1g (ORCPT ); Fri, 10 Jun 2016 02:27:36 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:38059 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750921AbcFJG1f (ORCPT ); Fri, 10 Jun 2016 02:27:35 -0400 Subject: Re: [PATCH] thermal: of-thermal: Fix setting of set_emul_temp hook To: Keerthy , , References: <1464857690-23330-1-git-send-email-j-keerthy@ti.com> CC: , , , From: Keerthy Message-ID: <575A5DD0.4080208@ti.com> Date: Fri, 10 Jun 2016 11:57:28 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1464857690-23330-1-git-send-email-j-keerthy@ti.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 02 June 2016 02:24 PM, Keerthy wrote: > Currently thermal zone set_emul_temp is set unconditionally > with of_thermal_set_emul_temp function. Set this only if the > set_emul_temp hook is provided for thermal_zone_of_device_ops. > > This fixes emul_temp failures on platforms for which set_emul_temp > hook is not populated. Eduardo, A gentle ping on this patch. > > Fixes: "184a4bf623f (thermal: of: Extend current > of-thermal.c code to allow setting emulated temp)" > Suggested-by: Eduardo Valentin > Signed-off-by: Keerthy > --- > drivers/thermal/of-thermal.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c > index b8e509c..93d8ce0 100644 > --- a/drivers/thermal/of-thermal.c > +++ b/drivers/thermal/of-thermal.c > @@ -181,9 +181,6 @@ static int of_thermal_set_emul_temp(struct thermal_zone_device *tz, > { > struct __thermal_zone *data = tz->devdata; > > - if (!data->ops || !data->ops->set_emul_temp) > - return -EINVAL; > - > return data->ops->set_emul_temp(data->sensor_data, temp); > } > > @@ -427,7 +424,9 @@ thermal_zone_of_add_sensor(struct device_node *zone, > > tzd->ops->get_temp = of_thermal_get_temp; > tzd->ops->get_trend = of_thermal_get_trend; > - tzd->ops->set_emul_temp = of_thermal_set_emul_temp; > + if (ops->set_emul_temp) > + tzd->ops->set_emul_temp = of_thermal_set_emul_temp; > + > mutex_unlock(&tzd->lock); > > return tzd; >