Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756451AbbKRRAa (ORCPT ); Wed, 18 Nov 2015 12:00:30 -0500 Received: from mail-bl2on0117.outbound.protection.outlook.com ([65.55.169.117]:4389 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756412AbbKRRA1 convert rfc822-to-8bit (ORCPT ); Wed, 18 Nov 2015 12:00:27 -0500 From: Hartley Sweeten To: Ian Abbott , Ranjith Thangavel , "gregkh@linuxfoundation.org" CC: "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 1/2] comedi: dmm32at: Fix coding style - use BIT macro Thread-Topic: [PATCH 1/2] comedi: dmm32at: Fix coding style - use BIT macro Thread-Index: AQHRIiANqLwIu37A60+zcDR9AHVcMp6h/BKA Date: Wed, 18 Nov 2015 16:45:21 +0000 Message-ID: References: <1447694308-7724-1-git-send-email-ranjithece24@gmail.com> <564CAA56.2030301@mev.co.uk> In-Reply-To: <564CAA56.2030301@mev.co.uk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=HartleyS@visionengravers.com; x-originating-ip: [184.183.19.121] x-microsoft-exchange-diagnostics: 1;BN3PR0101MB1058;5:8DCuEk6duXS9gmzeVCgSQ/NypWwhMwPFpkUZhlA5wKQUVV6n0FsxZ9U2mRY9GlikVjU90kt5jFz5x4J6wIlF+MoshsULPDw7AWPbZVnPUwzjkyxDfPZ6tBM6ciwiOIg52y5OVIQvO9MqtKddPHYcXA==;24:FGrry3bByohZMTC1oS3gvit9Mg89wDzk1Lv6Ima+j+pt5Z0AVvFtuuOyLuEvwbd2frsv3IRwd4EcQIdKHWB3tLFUv19ZyD+rt2Kd3OrDXq8=;20:osbulRrGkYkVLaAwNfCK1LoXwMyWi5RUetn5uQjvQlpBgeyUkXeGP9bEKVTs91R6Vd/ZG4jMvJul7h4a3GxVfw== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0101MB1058; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(2401047)(520078)(5005006)(8121501046)(10201501046)(3002001);SRVR:BN3PR0101MB1058;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0101MB1058; x-forefront-prvs: 0764C4A8CD x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(199003)(24454002)(377454003)(479174004)(189002)(81156007)(97736004)(80792005)(86362001)(5002640100001)(2900100001)(92566002)(2501003)(66066001)(33656002)(586003)(2950100001)(77096005)(189998001)(5001770100001)(5001960100002)(3846002)(102836003)(6116002)(101416001)(5003600100002)(5007970100001)(106116001)(122556002)(11100500001)(40100003)(76176999)(87936001)(5004730100002)(54356999)(50986999)(105586002)(106356001)(10400500002)(5008740100001)(74316001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN3PR0101MB1058;H:BN3PR0101MB1057.prod.exchangelabs.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: visionengravers.com X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2015 16:45:21.5678 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d698601f-af92-4269-8099-fd6f11636477 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0101MB1058 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1386 Lines: 35 On Wednesday, November 18, 2015 9:42 AM, Ian Abbott wrote: > On 16/11/15 17:18, Ranjith Thangavel wrote: [snip] >> -#define DMM32AT_AI_CFG_SCINT_20US (0 << 4) >> -#define DMM32AT_AI_CFG_SCINT_15US (1 << 4) >> -#define DMM32AT_AI_CFG_SCINT_10US (2 << 4) >> -#define DMM32AT_AI_CFG_SCINT_5US (3 << 4) >> -#define DMM32AT_AI_CFG_RANGE (1 << 3) /* 0=5V 1=10V */ >> -#define DMM32AT_AI_CFG_ADBU (1 << 2) /* 0=bipolar 1=unipolar */ >> +#define DMM32AT_AI_CFG_SCINT_20US 0 >> +#define DMM32AT_AI_CFG_SCINT_15US BIT(4) >> +#define DMM32AT_AI_CFG_SCINT_10US (BIT(5) & ~BIT(4)) > > The `(BIT(5) & ~BIT(4))` is a bit ugly. You can just use `BIT(5)` to > fit in with the style of your other changes. > > (Personally though, I don't think BIT() is appropriate for shifted, > multi-bit values.) It would be more appropriate as a macro: #define DMM32AT_AI_CFG_SCINT(x) (((x) & 0x3) << 4) #define DMM32AT_AI_CFG_SCINT_20US DMM32AT_AI_CFG_SCINT (0) #define DMM32AT_AI_CFG_SCINT_15US DMM32AT_AI_CFG_SCINT (1) #define DMM32AT_AI_CFG_SCINT_10US DMM32AT_AI_CFG_SCINT (2) #define DMM32AT_AI_CFG_SCINT_5US DMM32AT_AI_CFG_SCINT (3) Regards, Hartley -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/