From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752700AbdGFAmK (ORCPT ); Wed, 5 Jul 2017 20:42:10 -0400 Received: from mx.socionext.com ([202.248.49.38]:17464 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752479AbdGFAmI (ORCPT ); Wed, 5 Jul 2017 20:42:08 -0400 Date: Thu, 06 Jul 2017 09:42:06 +0900 From: Kunihiko Hayashi To: Masahiro Yamada Subject: Re: [PATCH v3 2/2] thermal: uniphier: add UniPhier thermal driver Cc: rui.zhang@intel.com, Eduardo Valentin , linux-pm@vger.kernel.org, linux-arm-kernel , Linux Kernel Mailing List , Rob Herring , Mark Rutland , Masami Hiramatsu , Jassi Brar In-Reply-To: References: Message-Id: <20170706094205.1DAF.4A936039@socionext.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.70 [ja] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 5 Jul 2017 21:27:57 +0900 wrote: > 2017-07-05 21:20 GMT+09:00 Masahiro Yamada : > > 2017-07-05 20:50 GMT+09:00 Kunihiko Hayashi : > > > >> + > >> +#define TMOD 0x0928 > >> +#define TMOD_MASK GENMASK(9, 0) > >> + > > [ snip ] > >> + > >> + /* > >> + * The bit[8:0] of TMOD register represents 2's complement value > >> + * of temperature in Celsius. Since bit8 of TMOD shows a sign bit, > >> + * 32bit temperature value is obtained by sign extension. > >> + */ > > > > > > Apparently, this comment does not match your code: > > > > #define TMOD_MASK GENMASK(9, 0) > > > > > > TMOD_MASK is indicating bit[9:0]. > > > > > > > > Digging into the patch history, now I understood what happened. > > > > > > > > In v1, you described > > #define TMOD_MASK 0x1ff > > > > This was correct. > > > > > > In v2, you converted it into > > #define TMOD_MASK GENMASK(9, 0) > > > > This was misconversion. It should be GENMASK(8, 0) > > > > > > > > Anyway, TMOD_MASK is not used any more. That's true. TMOD_MASK in v2/v3 is wrong, and not used no longer. > >> + *out_temp = sign_extend32(temp, 8) * 1000; > > > > > > Why magic number here? > > > > /* MSB of the TMOD field is a sign bit */ > > *out_temp = sign_extend32(temp, TMOD_WIDTH) * 1000; > > No. sign_extend32(temp, TMOD_WIDTH - 1) or > sign_extend32(temp, TMOD_MSB) or whatever. I see. I'll replace with the macro. Best Regards, Kunihiko Hayashi