linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Finn Thain <fthain@telegraphics.com.au>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Michael Schmitz <schmitzmic@gmail.com>,
	linux-scsi@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/6] esp_scsi: De-duplicate PIO routines
Date: Mon, 15 Oct 2018 12:58:42 +0200	[thread overview]
Message-ID: <2b48c925-73f0-0ca0-2f3c-3c35d90010ba@suse.de> (raw)
In-Reply-To: <alpine.LNX.2.21.1810151717520.10@nippy.intranet>

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 <userm57@yahoo.com>
>>> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
>>> Tested-by: Michael Schmitz <schmitzmic@gmail.com>
>>> ---
>>> 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)

  reply	other threads:[~2018-10-15 10:58 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-14  6:12 [PATCH v2 0/6] mac_esp, zorro_esp, esp_scsi: Various improvements Finn Thain
2018-10-14  6:12 ` [PATCH v2 4/6] esp_scsi: Eliminate ESP_FLAG_DOING_SLOWCMD Finn Thain
2018-10-14  6:12 ` [PATCH v2 6/6] esp_scsi: Optimize PIO loops Finn Thain
2018-10-14  6:12 ` [PATCH v2 3/6] esp_scsi: Grant disconnect privilege for untagged commands Finn Thain
2018-10-14 15:47   ` Christoph Hellwig
2018-10-14 20:33     ` Michael Schmitz
2018-10-14 23:04       ` Finn Thain
2018-10-14 23:13     ` Finn Thain
2018-10-15  2:45       ` Finn Thain
2018-10-15  5:52       ` Christoph Hellwig
2018-10-14  6:12 ` [PATCH v2 5/6] esp_scsi: De-duplicate PIO routines Finn Thain
2018-10-14 10:55   ` Geert Uytterhoeven
2018-10-15  2:32     ` Finn Thain
2018-10-15  6:14   ` Hannes Reinecke
2018-10-15  6:25     ` Finn Thain
2018-10-15 10:58       ` Hannes Reinecke [this message]
2018-10-15 12:53         ` Christoph Hellwig
2018-10-15 23:52         ` Finn Thain
2018-10-17  8:08           ` Christoph Hellwig
2018-10-16  5:39         ` Finn Thain
2018-10-17  8:09           ` Christoph Hellwig
2018-10-17 23:01             ` Finn Thain
2018-10-14  6:12 ` [PATCH v2 1/6] zorro_esp: Limit DMA transfers to 65535 bytes Finn Thain
2018-10-14  7:35   ` Michael Schmitz
2018-10-14 10:55   ` Geert Uytterhoeven
2018-10-14 22:00     ` Finn Thain
2018-10-14  6:12 ` [PATCH v2 2/6] esp_scsi: Track residual for PIO transfers Finn Thain
2018-10-14 10:55   ` Geert Uytterhoeven
2018-10-14 22:14     ` Finn Thain
2018-10-18  1:40 ` [PATCH v2 0/6] mac_esp, zorro_esp, esp_scsi: Various improvements Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2b48c925-73f0-0ca0-2f3c-3c35d90010ba@suse.de \
    --to=hare@suse.de \
    --cc=fthain@telegraphics.com.au \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=schmitzmic@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).