Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3767904imm; Mon, 15 Oct 2018 03:59:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV61m0go3pX6aIdxaKDLgXvHwweBnsYu+ZnnCxZhw15lOXnyvg0VY/xiT/8R4KQIUaUUerjNx X-Received: by 2002:a63:d00b:: with SMTP id z11-v6mr15857360pgf.317.1539601171008; Mon, 15 Oct 2018 03:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539601170; cv=none; d=google.com; s=arc-20160816; b=dOmgO3BcHvQ310o5RayVDWM7l2nf+R32+TEbcMCtwFsOMwHpW5A9uEcd4q/HiB3y7k tqkaJBoC1EeaMU+L3m0UgrksBSX8zQR8jG9IKoPU1U1L9GNiRA132/dp3+zCKEGjX2WE wUTIP8jg/GukcyxqN4ybqL3wejih1y+1uE3Ob5nH3euUr6DhpguetUeYcjwgnifgtE7Q wFhdykA+yyVjiNeUBnaSj07GZzHEqKQ1hRcykmHmCa5X/9CMdKBKM/h875cyxD7gPRHi n8fuE/ReorF0PkSKHICwn0RxHL4NahiBQ1jBd9+VCHgFCcIMhSbu1cxHGSpHfarx9jCZ Ko0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Hk+TTWVR3YcTmHIJyB3LNBgEDaW7IvmsIW/96gRhAnw=; b=VDDaUmWLx82cXnjgyATHbOFJz4XoA+wK0VNJUoi7hk0bmRZQCMzv5yhEonLIoQ9R3g f+vDhsj3j6/jzTVLNwDyzPzH2jN8aHj+usmBPEKYGWAQfdKtzeAvvfB+fbtQE528rvS0 UnAe1ucv/qp7TfIHJGTgE/9+k4DpYh9HWrdqsT/lBQYb4cWn9sKnmFefEnxmBTyAPW8G 5sYSZY3hO8hL0oKPdBwsnlWQJCGRlTV3q6h82c1jSByvjNhU/IWR4WgNruq3wJiW1Rb1 2mtMOn0y3znOMuy6K6V/20MmHIyriYAOZIqUPStY55iaffu1wcvuqKBmiaRP5KlizX4V zUIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10-v6si10882756pla.253.2018.10.15.03.59.16; Mon, 15 Oct 2018 03:59:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726641AbeJOSn2 (ORCPT + 99 others); Mon, 15 Oct 2018 14:43:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:33208 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726525AbeJOSn2 (ORCPT ); Mon, 15 Oct 2018 14:43:28 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7F661B034; Mon, 15 Oct 2018 10:58:42 +0000 (UTC) Subject: Re: [PATCH v2 5/6] esp_scsi: De-duplicate PIO routines To: Finn Thain Cc: "James E.J. Bottomley" , "Martin K. Petersen" , Michael Schmitz , linux-scsi@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org References: <35ac9f31-7068-ab93-4629-363ee0bb4c70@suse.de> From: Hannes Reinecke Message-ID: <2b48c925-73f0-0ca0-2f3c-3c35d90010ba@suse.de> Date: Mon, 15 Oct 2018 12:58:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/15/18 8:25 AM, Finn Thain wrote: > On Mon, 15 Oct 2018, Hannes Reinecke wrote: > >> On 10/14/18 8:12 AM, Finn Thain wrote: >>> As a temporary measure, the code to implement PIO transfers was >>> duplicated in zorro_esp and mac_esp. Now that it has stabilized >>> move the common code into the core driver but don't build it unless >>> needed. >>> >>> This replaces the inline assembler with more portable writesb() calls. >>> Optimizing the m68k writesb() implementation is a separate patch. >>> >>> Tested-by: Stan Johnson >>> Signed-off-by: Finn Thain >>> Tested-by: Michael Schmitz >>> --- >>> Changed since v1: >>> - Use shost_printk() instead of pr_err(). >>> - Add new symbol CONFIG_SCSI_ESP_PIO to Kconfig. >>> --- >>> drivers/scsi/Kconfig | 6 + >>> drivers/scsi/esp_scsi.c | 128 +++++++++++++++++++++ >>> drivers/scsi/esp_scsi.h | 5 + >>> drivers/scsi/mac_esp.c | 173 +---------------------------- >>> drivers/scsi/zorro_esp.c | 232 ++++++--------------------------------- >>> 5 files changed, 179 insertions(+), 365 deletions(-) >>> [ .. ] >>> diff --git a/drivers/scsi/esp_scsi.h b/drivers/scsi/esp_scsi.h >>> index d0c032803749..2590e5eda595 100644 >>> --- a/drivers/scsi/esp_scsi.h >>> +++ b/drivers/scsi/esp_scsi.h >>> @@ -431,6 +431,7 @@ struct esp_driver_ops { >>> struct esp { >>> void __iomem *regs; >>> void __iomem *dma_regs; >>> + u8 __iomem *fifo_reg; >>> const struct esp_driver_ops *ops; >>> @@ -540,6 +541,7 @@ struct esp { >>> void *dma; >>> int dmarev; >>> + int send_cmd_error; >>> int send_cmd_residual; >>> }; >>> >> These variables are only used within esp_send_pio_cmd(); consider making them >> conditional based on the config option. >> > > In the case of send_cmd_residual, that would mean a second #ifdef added to > esp_data_bytes_sent() where it gets used. I'm happy to comply but I fear > that all these #ifdefs may harm readability... > > There are already other variables in struct esp that may go unused, such > as dma_regs, that don't have #ifdefs to elide them. Are these also > problematic in some way? > The unused fields in the struct are not so much an issue; in fact, it rather complicated things when having individual fields in the struct surrounded by CONFIG_XXX, as then the order of the fields would change depending on the configuration. Which makes it really hard to debug .. However, the function declaration really is a worry, as the actual function body only exists when the config option is enabled. So either add a dummy function or surround the function declaration by CONFIG_ESP_PIO. Otherwise I think Dan Carpenter and the likes are guaranteed to send you a nice mail complaining about this ... Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)