From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757447AbdJKNZz (ORCPT ); Wed, 11 Oct 2017 09:25:55 -0400 Received: from mx2.suse.de ([195.135.220.15]:45106 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752168AbdJKNZx (ORCPT ); Wed, 11 Oct 2017 09:25:53 -0400 Date: Wed, 11 Oct 2017 15:25:52 +0200 From: Johannes Thumshirn To: Steffen Maier Cc: "Martin K . Petersen" , Linux Kernel Mailinglist , Linux SCSI Mailinglist , Tejun Heo , Bart Van Assche , Oliver Neukum , Alan Stern Subject: Re: [PATCH] scsi: use set_host_byte instead of open-coding it Message-ID: <20171011132552.tqfrg6ccqny2bzn2@linux-x5ow.site> References: <20171010152939.21353-1-jthumshirn@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 11, 2017 at 03:05:40PM +0200, Steffen Maier wrote: > Maybe I misunderstand, but doesn't set_host_byte only set the host byte but > leave the other 3 parts untouched in c->result? > > static inline void set_host_byte(struct scsi_cmnd *cmd, char status) > { > cmd->result = (cmd->result & 0xff00ffff) | (status << 16); > } > > In contrast, assigning something to c->result resets all parts. > If so, the semantic patch would introduce a subtle semantic change. > Unless it's guaranteed that in all the touched cases, c->result always has 0 > for status, message, and driver byte before calling set_host_byte(). Yes it does, another case I'll have to add to my coccinelle spatch, thanks for reminding me (and I'm also doing it for set_msg_byte() and set_driver_byte(), the status byte will be done manually probably). > > Bart's suggestion also sounds nice. Yes I'm working on implementing it currently. > > FYI: Originally, I only thought about using set_host_byte in that one place > fix of yours; I did not expect a full framework rework. Oh well: $ git diff --stat master.. [..] 80 files changed, 589 insertions(+), 540 deletions(-) Byte, Johannes -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850