diff mbox

[v11,7/7] ntb: ntb_hw_switchtec: Cleanup 64bit IO defines to use the common header

Message ID 20180305190824.847-8-logang@deltatee.com (mailing list archive)
State Not Applicable
Delegated to: Herbert Xu
Headers show

Commit Message

Logan Gunthorpe March 5, 2018, 7:08 p.m. UTC
Clean up the ifdefs which conditionally defined the io{read|write}64
functions in favour of the new common io-64-nonatomic-lo-hi header.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Jon Mason <jdmason@kudzu.us>
---
 drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 30 +-----------------------------
 1 file changed, 1 insertion(+), 29 deletions(-)

Comments

Andy Shevchenko March 6, 2018, 10:48 a.m. UTC | #1
On Mon, Mar 5, 2018 at 9:08 PM, Logan Gunthorpe <logang@deltatee.com> wrote:
> Clean up the ifdefs which conditionally defined the io{read|write}64
> functions in favour of the new common io-64-nonatomic-lo-hi header.

>  #include <linux/kthread.h>
>  #include <linux/interrupt.h>
>  #include <linux/ntb.h>
> +#include <linux/io-64-nonatomic-lo-hi.h>

A nit, can we preserve alphabetical ordering?
Greg Kroah-Hartman March 6, 2018, 11:46 a.m. UTC | #2
On Tue, Mar 06, 2018 at 12:48:29PM +0200, Andy Shevchenko wrote:
> On Mon, Mar 5, 2018 at 9:08 PM, Logan Gunthorpe <logang@deltatee.com> wrote:
> > Clean up the ifdefs which conditionally defined the io{read|write}64
> > functions in favour of the new common io-64-nonatomic-lo-hi header.
> 
> >  #include <linux/kthread.h>
> >  #include <linux/interrupt.h>
> >  #include <linux/ntb.h>
> > +#include <linux/io-64-nonatomic-lo-hi.h>
> 
> A nit, can we preserve alphabetical ordering?

Ugh, why, it doesn't matter at all :)
Andy Shevchenko March 6, 2018, 11:57 a.m. UTC | #3
On Tue, Mar 6, 2018 at 1:46 PM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Tue, Mar 06, 2018 at 12:48:29PM +0200, Andy Shevchenko wrote:
>> On Mon, Mar 5, 2018 at 9:08 PM, Logan Gunthorpe <logang@deltatee.com> wrote:
>> > Clean up the ifdefs which conditionally defined the io{read|write}64
>> > functions in favour of the new common io-64-nonatomic-lo-hi header.
>>
>> >  #include <linux/kthread.h>
>> >  #include <linux/interrupt.h>
>> >  #include <linux/ntb.h>
>> > +#include <linux/io-64-nonatomic-lo-hi.h>
>>
>> A nit, can we preserve alphabetical ordering?
>
> Ugh, why, it doesn't matter at all :)

I'm fine with either way, but ordering is a good thing to have in long
term prospective.
Easy to find what headers are in there, easy to understand if you need
another one or not, easy to maintain the list w/o duplications.

I saw already few examples where long list of headers contained
duplications b/c it was in messy order.
Logan Gunthorpe March 6, 2018, 5:03 p.m. UTC | #4
On 06/03/18 04:57 AM, Andy Shevchenko wrote:
> On Tue, Mar 6, 2018 at 1:46 PM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
>> On Tue, Mar 06, 2018 at 12:48:29PM +0200, Andy Shevchenko wrote:
>>> On Mon, Mar 5, 2018 at 9:08 PM, Logan Gunthorpe <logang@deltatee.com> wrote:
>>>> Clean up the ifdefs which conditionally defined the io{read|write}64
>>>> functions in favour of the new common io-64-nonatomic-lo-hi header.
>>>
>>>>   #include <linux/kthread.h>
>>>>   #include <linux/interrupt.h>
>>>>   #include <linux/ntb.h>
>>>> +#include <linux/io-64-nonatomic-lo-hi.h>
>>>
>>> A nit, can we preserve alphabetical ordering?
>>
>> Ugh, why, it doesn't matter at all :)
> 
> I'm fine with either way, but ordering is a good thing to have in long
> term prospective.
> Easy to find what headers are in there, easy to understand if you need
> another one or not, easy to maintain the list w/o duplications.
> 
> I saw already few examples where long list of headers contained
> duplications b/c it was in messy order.
> 

I agree with Greg here. This is a bit silly. The list isn't even 
alphabetical to begin with so it can't be preserved. However, if I do a 
v12 I'll make it alphabetical.

Logan
diff mbox

Patch

diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
index f624ae27eabe..d2a1e746b335 100644
--- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
+++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
@@ -19,6 +19,7 @@ 
 #include <linux/kthread.h>
 #include <linux/interrupt.h>
 #include <linux/ntb.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
 
 MODULE_DESCRIPTION("Microsemi Switchtec(tm) NTB Driver");
 MODULE_VERSION("0.1");
@@ -35,35 +36,6 @@  module_param(use_lut_mws, bool, 0644);
 MODULE_PARM_DESC(use_lut_mws,
 		 "Enable the use of the LUT based memory windows");
 
-#ifndef ioread64
-#ifdef readq
-#define ioread64 readq
-#else
-#define ioread64 _ioread64
-static inline u64 _ioread64(void __iomem *mmio)
-{
-	u64 low, high;
-
-	low = ioread32(mmio);
-	high = ioread32(mmio + sizeof(u32));
-	return low | (high << 32);
-}
-#endif
-#endif
-
-#ifndef iowrite64
-#ifdef writeq
-#define iowrite64 writeq
-#else
-#define iowrite64 _iowrite64
-static inline void _iowrite64(u64 val, void __iomem *mmio)
-{
-	iowrite32(val, mmio);
-	iowrite32(val >> 32, mmio + sizeof(u32));
-}
-#endif
-#endif
-
 #define SWITCHTEC_NTB_MAGIC 0x45CC0001
 #define MAX_MWS     128