Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1948967AbdDYPLQ (ORCPT ); Tue, 25 Apr 2017 11:11:16 -0400 Received: from 1.mo6.mail-out.ovh.net ([46.105.56.136]:54427 "EHLO 1.mo6.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1948849AbdDYPKV (ORCPT ); Tue, 25 Apr 2017 11:10:21 -0400 X-Greylist: delayed 1793 seconds by postgrey-1.27 at vger.kernel.org; Tue, 25 Apr 2017 11:10:21 EDT Subject: Re: [PATCH] hwmon: (ibmpowernv) Add min/max attributes and current sensors To: Shilpasri G Bhat , Jean Delvare , Guenter Roeck , Paul Mackerras , Michael Ellerman References: <1492749112-32465-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com> Cc: linux-hwmon@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, svaidy@linux.vnet.ibm.com, ego@linux.vnet.ibm.com, akshay.adiga@linux.vnet.ibm.com, andrew@aj.id.au From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: Date: Tue, 25 Apr 2017 16:34:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1492749112-32465-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Ovh-Tracer-Id: 6812820338619288491 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeeliedrgedvgdejlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 494 Lines: 18 ... > + sdata[count].id = sensor_id; > + sdata[count].type = type; > + sdata[count].hwmon_index = sdata[count - 1].hwmon_index; > + create_hwmon_attr(&sdata[count], attr_name, > + show_sensor); > + pgroups[type]->attrs[sensor_groups[type].attr_count++] = > + &sdata[count++].dev_attr.attr; > + } We are duplicating these lines at least three times. I wonder if we could make a routine for them. Don't bother doing so if the number of arguments is too large. Thanks, C.