scsi/NCR5380: fix debugging macros and #include structure
cover scsi/NCR5380: fix debugging macros and #include structure
(Second attempt... sorry for the earlier spam.)
This patch series addresses several issues with NCR5380 drivers:
1. The complex network of #include directives.
2. Three inconsistent implementations of the core driver all attempting to share the same macro definitions in NCR5380.h.
3. Broken debugging code.
In the past these issues have led to compiler warnings and ugly hacks to fix build failures.
This patch series fixes the debugging code by reducing the divergence between the various core driver implementations.
The final two patches in the series further reduce divergence by refactoring sun3_scsi.c and sun3_scsi_vme.c so that they follow the same structure as the other NCR5380 drivers.
By the end of this patch series over 800 net lines of code have been removed. This is mostly duplicated code that's easily eliminated once the debugging code is made consistent (and some dead code is removed).
Better uniformity and less duplication should assist future work such as modernization and trivial clean-up.
To make code review easier I've tried to keep these patches succinct and free of extraneous changes. Though I did run checkpatch.pl, I've ignored whitespace issues in existing code. I will send separate patches for whitespace clean-up of NCR5380 drivers.
All NCR5380 drivers have been compile-tested with this patch series:
arm/cumana_1.c
arm/oak.c
atari_scsi.c
dmx3191d.c
dtc.c
g_NCR5380.c
g_NCR5380_mmio.c
mac_scsi.c
pas16.c
sun3_scsi.c
sun3_scsi_vme.c
t128.c
I've successfully regression tested this patch series using mac_scsi on a PowerBook 180. The debugging macros are now usable again.
PATCH 1/12 scsi/NCR5380: remove unused BOARD_NORMAL and BOARD_NCR53C400
An embedded and charset-unspecified text was scrubbed...
Name: ncr5380-BOARD-macros
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/1fe6b0cf/attachment.ksh>
Re: [PATCH 01/12] scsi/NCR5380: remove unused BOARD_NORMAL and BOARD_NCR53C400
Quoted 4 lines · Finn Thain
BOARD_NORMALis completely unused andBOARD_NCR53C400is used only byg_NCR5380internally. Remove the unused definitions.Signed-off-by Finn Thain <[email protected]>
Looks good,
PATCH 2/12 scsi/NCR5380: remove redundant HOSTS_C macro tests
In reply to Finn ThainAn embedded and charset-unspecified text was scrubbed...
Name: ncr5380-HOSTS_C-macro
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/fec75727/attachment.ksh>
Re: [PATCH 02/12] scsi/NCR5380: remove redundant HOSTS_C macro tests
Quoted 3 lines · Finn Thain
HOSTS_Cis always undefined. There is nohosts.canymore.Signed-off-by Finn Thain <[email protected]>
Looks good,
PATCH 3/12 scsi/NCR5380: remove old CVS keywords
In reply to Finn ThainAn embedded and charset-unspecified text was scrubbed...
Name: ncr5380-remove-cvs-keywords
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/c7fa994e/attachment.ksh>
Re: [PATCH 03/12] scsi/NCR5380: remove old CVS keywords
Quoted 1 line · Finn Thain
Signed-off-by Finn Thain <[email protected]>
Looks good,
PATCH 4/12 scsi/NCR5380: use NCR5380_dprint() instead of NCR5380_print()
In reply to Finn ThainAn embedded and charset-unspecified text was scrubbed...
Name: ncr5380-debug-macros-sun3-NCR5380_print
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/ba5a5468/attachment.ksh>
Re: [PATCH 04/12] scsi/NCR5380: use NCR5380_dprint() instead of NCR5380_print()
Quoted 5 lines · Finn Thain
Only the
NCR5380_dprint()macro should invoke theNCR5380_print()function. That's whyNCR5380.conly defines the function #if NDEBUG. Use the standard macro.Signed-off-by Finn Thain <[email protected]>
Looks good,
PATCH 5/12 scsi/NCR5380: fix build failures when debugging is enabled
In reply to Finn ThainAn embedded and charset-unspecified text was scrubbed...
Name: ncr5380-debug-macros-build-failures
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/ffbc9e5f/attachment.ksh>
Re: [PATCH 05/12] scsi/NCR5380: fix build failures when debugging is enabled
Quoted 9 lines · Finn Thain
The change from
cmd->targettocmd->device->idwas apparently the purpose of commita7f251228390e87d86c5e3846f99a455517fdd8einkernel/git/tglx/history.gitbut some instances have been missed.Also fix the "
NDEBUG_LAST_WRITE_SENT" and "NDEBUG_ALL" typo's.Also fix some format strings (%ul becomes %lu) that caused compiler warnings.
Signed-off-by Finn Thain <[email protected]>
Looks good,
Re: [PATCH 05/12] scsi/NCR5380: fix build failures when debugging is enabled
Quoted 4 lines · Christoph Hellwig
Looks good,
Reviewed-by Christoph Hellwig <[email protected]>
Thanks for reviewing. There was a later submission (version 2) with changes made to three of these patches,
[PATCH v2 05/12] scsi/NCR5380: fix build failures when debugging is enabled [PATCH v2 06/12] scsi/NCR5380: fix dprintk macro usage and definition [PATCH v2 09/12] scsi/NCR5380: fix and standardize NDEBUG macros
And several patches in the v2 submission had some acked-by tags added.
The v2 series is the one to merge (but I think James intends to do that).
Re: [PATCH 05/12] scsi/NCR5380: fix build failures when debugging is enabled
Quoted 7 lines · Finn Thain
[PATCH v2 05/12] scsi/NCR5380: fix build failures when debugging is enabled [PATCH v2 06/12] scsi/NCR5380: fix dprintk macro usage and definition [PATCH v2 09/12] scsi/NCR5380: fix and standardize NDEBUG macros
And several patches in the v2 submission had some acked-by tags added.
The v2 series is the one to merge (but I think James intends to do that).
I've pulled this version into the for-3.16 drivers tree I'm collection for james:
http://git.infradead.org/users/hch/scsi-queue.git/shortlog/refs/heads/drivers-for-3.16
git://git.infradead.org/users/hch/scsi-queue.git drivers-for-3.16
Can you send incremental changes if needed?
PATCH 6/12 scsi/NCR5380: fix dprintk macro usage and definition
In reply to Finn ThainAn embedded and charset-unspecified text was scrubbed...
Name: ncr5380-debug-macros-dprintk-params
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/d7ab36b9/attachment.ksh>
Re: [PATCH 06/12] scsi/NCR5380: fix dprintk macro usage and definition
Quoted 8 lines · Finn Thain
There are three implementations of the core NCR5380 driver and three sets of debugging macro definitions. And all three implementations use the
NCR5380.hheader as well.Two of the definitions of the dprintk macro accept a variable argument list whereas the third does not. Standardize on the variable argument list.
Signed-off-by Finn Thain <[email protected]>
Looks good,
PATCH 7/12 scsi/NCR5380: adopt NCR5380_dprint() and NCR5380_dprint_phase()
In reply to Finn ThainAn embedded and charset-unspecified text was scrubbed...
Name: ncr5380-debug-macros-substitute-NCRPRINT
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/ee78eeed/attachment.ksh>
Re: [PATCH 07/12] scsi/NCR5380: adopt NCR5380_dprint() and NCR5380_dprint_phase()
Quoted 11 lines · Finn Thain
All NCR5380 drivers already include the
NCR5380.hheader. Better to adopt those macros rather than have three variations on them.Moreover, the macros in
NCR5380.hare preferable anyway: theatari_NCR5380andsun3_NCR5380versions are inflexible. For example, they can't accomodateNCR5380_dprint(NDEBUG_MAIN | NDEBUG_QUEUES, ...)Replace the NCR_PRINT* macros from
atari_NCR5380.handsun3_NCR5380.hwith the equivalent macros fromNCR5380.h.Signed-off-by Finn Thain <[email protected]>
Looks good,
PATCH 8/12 scsi/NCR5380: adopt dprintk()
In reply to Finn ThainAn embedded and charset-unspecified text was scrubbed...
Name: ncr5380-debug-macros-substitute-X_PRINTK
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/30865ff5/attachment.ksh>
Re: [PATCH 08/12] scsi/NCR5380: adopt dprintk()
Quoted 11 lines · Finn Thain
All NCR5380 drivers already include the
NCR5380.hheader. Better to adopt those macros rather than have three variations on them.Moreover, the macros in
NCR5380.hare preferable because theatari_NCR5380andsun3_NCR5380versions are inflexible. For example, they can't accomodatedprintk(NDEBUG_MAIN | NDEBUG_QUEUES, ...)Replace the
*_PRINTKmacros fromatari_NCR5380.handsun3_NCR5380.hwith the equivalent macros fromNCR5380.h.Signed-off-by Finn Thain <[email protected]>
Looks good,
PATCH 9/12 scsi/NCR5380: fix and standardize NDEBUG macros
In reply to Finn ThainAn embedded and charset-unspecified text was scrubbed...
Name: ncr5380-debug-macros-fix-NDEBUG
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/0214b636/attachment.ksh>
Re: [PATCH 09/12] scsi/NCR5380: fix and standardize NDEBUG macros
Quoted 17 lines · Finn Thain
All three NCR5380 core driver implementations share the same
NCR5380.hheader file so they need to agree on certain macro definitions.The flag bit used by the
NDEBUG_MERGINGmacro inatari_NCR5380andsun3_NCR5380collides with the bit used byNDEBUG_LISTS.Moreover,
NDEBUG_ABORTappears inNCR5380.cso it should be defined inNCR5380.hrather than in each of the many drivers using that core.An undefined
NDEBUG_ABORTmacro caused compiler errors and led to dodgy workarounds in the core driver that can now be removed.
(See commitsf566a576bca09de85bf477fc0ab2c8c96405b77band185a7a1cd79b9891e3c17abdb103ba1c98d6ca7a.)Move all of the
NDEBUG_ABORT,NDEBUG_TAGSandNDEBUG_MERGINGmacro definitions intoNCR5380.hwhere all the other NDEBUG macros live.
Quoted 8 lines
Also, incorrect "#ifdef NDEBUG" becomes "#if NDEBUG" to fix the warning:
drivers/scsi/mac_scsi.c: At top level:drivers/scsi/NCR5380.c:418: warning: 'NCR5380_print' defined but not useddrivers/scsi/NCR5380.c:459: warning: 'NCR5380_print_phase' defined but not usedThe debugging code is now enabled when NDEBUG != 0.
Signed-off-by Finn Thain <[email protected]>
Looks good,
PATCH 10/12 scsi/NCR5380: remove unused macro definitions
In reply to Finn ThainAn embedded and charset-unspecified text was scrubbed...
Name: ncr5380-debug-macros-remove-X_PRINTK-NCRPRINT
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/ef907de7/attachment.ksh>
Re: [PATCH 10/12] scsi/NCR5380: remove unused macro definitions
Quoted 5 lines · Finn Thain
Remove the unused (and divergent) debugging macro definitions from the
sun3_NCR5380andatari_NCR5380drivers. These drivers have been converted to use the common macros inNCR5380.h.Signed-off-by Finn Thain <[email protected]>
Looks good,
PATCH 11/12 scsi/NCR5380: reduce depth of sun3_scsi nested includes
In reply to Finn ThainAn embedded and charset-unspecified text was scrubbed...
Name: ncr5380-sun3-includes
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/96fc3260/attachment.ksh>
Re: [PATCH 11/12] scsi/NCR5380: reduce depth of sun3_scsi nested includes
Quoted 7 lines · Finn Thain
Move the #include "
NCR5380.h" out of thesun3_scsi.hheader file and into the driver .c files, like all the other NCR5380 drivers in the tree.This improves uniformity and reduces the depth of nested includes. The sequence of #include's, #define's and #if's no longer does my head in.
Signed-off-by Finn Thain <[email protected]>
Looks good,
PATCH 12/12 scsi/NCR5380: merge sun3_scsi_vme.c into sun3_scsi.c
In reply to Finn ThainAn embedded and charset-unspecified text was scrubbed...
Name: ncr5380-sun3-vme-merge
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140318/72dfb411/attachment.ksh>
Re: [PATCH 12/12] scsi/NCR5380: merge sun3_scsi_vme.c into sun3_scsi.c
Quoted 9 lines · Finn Thain
The sun3 drivers suffer from a whole bunch of duplicated code. Fix this by following the
g_NCR5380_mmioexample. (Notionally,sun3_scsirelates tosun3_scsi_vmein the same way thatg_NCR5380relates tog_NCR5380_mmio.)Dead code is also removed: we now have working debug macros so
SUN3_SCSI_DEBUGis undesirable. Dead code within #ifdefOLD_DMAis also dropped, consistent withsun3_scsi_vme.c.Signed-off-by Finn Thain <[email protected]>
Looks good,