Re: [PATCH 17/19] z2ram: reindent

2020-09-04 Thread Hannes Reinecke

On 9/3/20 10:01 AM, Christoph Hellwig wrote:

reindent the driver using Lident as the code style was far away from
normal Linux code.

Signed-off-by: Christoph Hellwig 
---
  drivers/block/z2ram.c | 493 --
  1 file changed, 236 insertions(+), 257 deletions(-)


Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
--
Dr. Hannes ReineckeKernel Storage Architect
h...@suse.de  +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer


[PATCH 17/19] z2ram: reindent

2020-09-03 Thread Christoph Hellwig
reindent the driver using Lident as the code style was far away from
normal Linux code.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/z2ram.c | 493 --
 1 file changed, 236 insertions(+), 257 deletions(-)

diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 0e734802ee7cc6..eafecc9a72b38d 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -42,7 +42,6 @@
 
 #include 
 
-
 #define Z2MINOR_COMBINED  (0)
 #define Z2MINOR_Z2ONLY(1)
 #define Z2MINOR_CHIPONLY  (2)
@@ -50,17 +49,17 @@
 #define Z2MINOR_MEMLIST2  (5)
 #define Z2MINOR_MEMLIST3  (6)
 #define Z2MINOR_MEMLIST4  (7)
-#define Z2MINOR_COUNT (8) /* Move this down when adding a new minor */
+#define Z2MINOR_COUNT (8)  /* Move this down when adding a new 
minor */
 
 #define Z2RAM_CHUNK1024   ( Z2RAM_CHUNKSIZE >> 10 )
 
 static DEFINE_MUTEX(z2ram_mutex);
-static u_long *z2ram_map= NULL;
-static u_long z2ram_size= 0;
-static int z2_count = 0;
-static int chip_count   = 0;
-static int list_count   = 0;
-static int current_device   = -1;
+static u_long *z2ram_map = NULL;
+static u_long z2ram_size = 0;
+static int z2_count = 0;
+static int chip_count = 0;
+static int list_count = 0;
+static int current_device = -1;
 
 static DEFINE_SPINLOCK(z2ram_lock);
 
@@ -71,7 +70,7 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx *hctx,
 {
struct request *req = bd->rq;
unsigned long start = blk_rq_pos(req) << 9;
-   unsigned long len  = blk_rq_cur_bytes(req);
+   unsigned long len = blk_rq_cur_bytes(req);
 
blk_mq_start_request(req);
 
@@ -92,7 +91,7 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx *hctx,
 
if (len < size)
size = len;
-   addr += z2ram_map[ start >> Z2RAM_CHUNKSHIFT ];
+   addr += z2ram_map[start >> Z2RAM_CHUNKSHIFT];
if (rq_data_dir(req) == READ)
memcpy(buffer, (char *)addr, size);
else
@@ -106,228 +105,214 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx 
*hctx,
return BLK_STS_OK;
 }
 
-static void
-get_z2ram( void )
+static void get_z2ram(void)
 {
-int i;
-
-for ( i = 0; i < Z2RAM_SIZE / Z2RAM_CHUNKSIZE; i++ )
-{
-   if ( test_bit( i, zorro_unused_z2ram ) )
-   {
-   z2_count++;
-   z2ram_map[z2ram_size++] = (unsigned long)ZTWO_VADDR(Z2RAM_START) +
- (i << Z2RAM_CHUNKSHIFT);
-   clear_bit( i, zorro_unused_z2ram );
+   int i;
+
+   for (i = 0; i < Z2RAM_SIZE / Z2RAM_CHUNKSIZE; i++) {
+   if (test_bit(i, zorro_unused_z2ram)) {
+   z2_count++;
+   z2ram_map[z2ram_size++] =
+   (unsigned long)ZTWO_VADDR(Z2RAM_START) +
+   (i << Z2RAM_CHUNKSHIFT);
+   clear_bit(i, zorro_unused_z2ram);
+   }
}
-}
 
-return;
+   return;
 }
 
-static void
-get_chipram( void )
+static void get_chipram(void)
 {
 
-while ( amiga_chip_avail() > ( Z2RAM_CHUNKSIZE * 4 ) )
-{
-   chip_count++;
-   z2ram_map[ z2ram_size ] =
-   (u_long)amiga_chip_alloc( Z2RAM_CHUNKSIZE, "z2ram" );
+   while (amiga_chip_avail() > (Z2RAM_CHUNKSIZE * 4)) {
+   chip_count++;
+   z2ram_map[z2ram_size] =
+   (u_long) amiga_chip_alloc(Z2RAM_CHUNKSIZE, "z2ram");
 
-   if ( z2ram_map[ z2ram_size ] == 0 )
-   {
-   break;
+   if (z2ram_map[z2ram_size] == 0) {
+   break;
+   }
+
+   z2ram_size++;
}
 
-   z2ram_size++;
-}
-   
-return;
+   return;
 }
 
 static int z2_open(struct block_device *bdev, fmode_t mode)
 {
-int device;
-int max_z2_map = ( Z2RAM_SIZE / Z2RAM_CHUNKSIZE ) *
-   sizeof( z2ram_map[0] );
-int max_chip_map = ( amiga_chip_size / Z2RAM_CHUNKSIZE ) *
-   sizeof( z2ram_map[0] );
-int rc = -ENOMEM;
-
-device = MINOR(bdev->bd_dev);
-
-mutex_lock(_mutex);
-if ( current_device != -1 && current_device != device )
-{
-   rc = -EBUSY;
-   goto err_out;
-}
-
-if ( current_device == -1 )
-{
-   z2_count   = 0;
-   chip_count = 0;
-   list_count = 0;
-   z2ram_size = 0;
-
-   /* Use a specific list entry. */
-   if (device >= Z2MINOR_MEMLIST1 && device <= Z2MINOR_MEMLIST4) {
-   int index = device - Z2MINOR_MEMLIST1 + 1;
-   unsigned long size, paddr, vaddr;
-
-   if (index >= m68k_realnum_memory) {
-   printk( KERN_ERR DEVICE_NAME
-   ": no such entry in z2ram_map\n" );
-   goto err_out;
-   }
-
-   paddr = m68k_memory[index].addr;
-   size = 

[PATCH 17/19] z2ram: reindent

2020-08-30 Thread Christoph Hellwig
reindent the driver using Lident as the code style was far away from
normal Linux code.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/z2ram.c | 493 --
 1 file changed, 236 insertions(+), 257 deletions(-)

diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 0e734802ee7cc6..eafecc9a72b38d 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -42,7 +42,6 @@
 
 #include 
 
-
 #define Z2MINOR_COMBINED  (0)
 #define Z2MINOR_Z2ONLY(1)
 #define Z2MINOR_CHIPONLY  (2)
@@ -50,17 +49,17 @@
 #define Z2MINOR_MEMLIST2  (5)
 #define Z2MINOR_MEMLIST3  (6)
 #define Z2MINOR_MEMLIST4  (7)
-#define Z2MINOR_COUNT (8) /* Move this down when adding a new minor */
+#define Z2MINOR_COUNT (8)  /* Move this down when adding a new 
minor */
 
 #define Z2RAM_CHUNK1024   ( Z2RAM_CHUNKSIZE >> 10 )
 
 static DEFINE_MUTEX(z2ram_mutex);
-static u_long *z2ram_map= NULL;
-static u_long z2ram_size= 0;
-static int z2_count = 0;
-static int chip_count   = 0;
-static int list_count   = 0;
-static int current_device   = -1;
+static u_long *z2ram_map = NULL;
+static u_long z2ram_size = 0;
+static int z2_count = 0;
+static int chip_count = 0;
+static int list_count = 0;
+static int current_device = -1;
 
 static DEFINE_SPINLOCK(z2ram_lock);
 
@@ -71,7 +70,7 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx *hctx,
 {
struct request *req = bd->rq;
unsigned long start = blk_rq_pos(req) << 9;
-   unsigned long len  = blk_rq_cur_bytes(req);
+   unsigned long len = blk_rq_cur_bytes(req);
 
blk_mq_start_request(req);
 
@@ -92,7 +91,7 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx *hctx,
 
if (len < size)
size = len;
-   addr += z2ram_map[ start >> Z2RAM_CHUNKSHIFT ];
+   addr += z2ram_map[start >> Z2RAM_CHUNKSHIFT];
if (rq_data_dir(req) == READ)
memcpy(buffer, (char *)addr, size);
else
@@ -106,228 +105,214 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx 
*hctx,
return BLK_STS_OK;
 }
 
-static void
-get_z2ram( void )
+static void get_z2ram(void)
 {
-int i;
-
-for ( i = 0; i < Z2RAM_SIZE / Z2RAM_CHUNKSIZE; i++ )
-{
-   if ( test_bit( i, zorro_unused_z2ram ) )
-   {
-   z2_count++;
-   z2ram_map[z2ram_size++] = (unsigned long)ZTWO_VADDR(Z2RAM_START) +
- (i << Z2RAM_CHUNKSHIFT);
-   clear_bit( i, zorro_unused_z2ram );
+   int i;
+
+   for (i = 0; i < Z2RAM_SIZE / Z2RAM_CHUNKSIZE; i++) {
+   if (test_bit(i, zorro_unused_z2ram)) {
+   z2_count++;
+   z2ram_map[z2ram_size++] =
+   (unsigned long)ZTWO_VADDR(Z2RAM_START) +
+   (i << Z2RAM_CHUNKSHIFT);
+   clear_bit(i, zorro_unused_z2ram);
+   }
}
-}
 
-return;
+   return;
 }
 
-static void
-get_chipram( void )
+static void get_chipram(void)
 {
 
-while ( amiga_chip_avail() > ( Z2RAM_CHUNKSIZE * 4 ) )
-{
-   chip_count++;
-   z2ram_map[ z2ram_size ] =
-   (u_long)amiga_chip_alloc( Z2RAM_CHUNKSIZE, "z2ram" );
+   while (amiga_chip_avail() > (Z2RAM_CHUNKSIZE * 4)) {
+   chip_count++;
+   z2ram_map[z2ram_size] =
+   (u_long) amiga_chip_alloc(Z2RAM_CHUNKSIZE, "z2ram");
 
-   if ( z2ram_map[ z2ram_size ] == 0 )
-   {
-   break;
+   if (z2ram_map[z2ram_size] == 0) {
+   break;
+   }
+
+   z2ram_size++;
}
 
-   z2ram_size++;
-}
-   
-return;
+   return;
 }
 
 static int z2_open(struct block_device *bdev, fmode_t mode)
 {
-int device;
-int max_z2_map = ( Z2RAM_SIZE / Z2RAM_CHUNKSIZE ) *
-   sizeof( z2ram_map[0] );
-int max_chip_map = ( amiga_chip_size / Z2RAM_CHUNKSIZE ) *
-   sizeof( z2ram_map[0] );
-int rc = -ENOMEM;
-
-device = MINOR(bdev->bd_dev);
-
-mutex_lock(_mutex);
-if ( current_device != -1 && current_device != device )
-{
-   rc = -EBUSY;
-   goto err_out;
-}
-
-if ( current_device == -1 )
-{
-   z2_count   = 0;
-   chip_count = 0;
-   list_count = 0;
-   z2ram_size = 0;
-
-   /* Use a specific list entry. */
-   if (device >= Z2MINOR_MEMLIST1 && device <= Z2MINOR_MEMLIST4) {
-   int index = device - Z2MINOR_MEMLIST1 + 1;
-   unsigned long size, paddr, vaddr;
-
-   if (index >= m68k_realnum_memory) {
-   printk( KERN_ERR DEVICE_NAME
-   ": no such entry in z2ram_map\n" );
-   goto err_out;
-   }
-
-   paddr = m68k_memory[index].addr;
-   size = 

Re: [PATCH 17/19] z2ram: reindent

2020-08-27 Thread Christoph Hellwig
On Fri, Aug 28, 2020 at 10:57:46AM +1000, Finn Thain wrote:
> On Thu, 27 Aug 2020, Joe Perches wrote:
> 
> > 
> > checkpatch already does this.
> > 
> 
> Did you use checkpatch to generate this patch?

I used scripts/Lindent.


Re: [PATCH 17/19] z2ram: reindent

2020-08-27 Thread Joe Perches
On Fri, 2020-08-28 at 10:57 +1000, Finn Thain wrote:
> On Thu, 27 Aug 2020, Joe Perches wrote:
> 
> > checkpatch already does this.
> > 
> 
> Did you use checkpatch to generate this patch?

Nope.



Re: [PATCH 17/19] z2ram: reindent

2020-08-27 Thread Finn Thain
On Thu, 27 Aug 2020, Joe Perches wrote:

> 
> checkpatch already does this.
> 

Did you use checkpatch to generate this patch?


Re: [PATCH 17/19] z2ram: reindent

2020-08-27 Thread Joe Perches
On Fri, 2020-08-28 at 09:21 +1000, Finn Thain wrote:
> > @@ -109,34 +111,28 @@ static void get_z2ram(void)
> ...
> > }
> > -
> > -   return;
> >  }
> >  
> 
> It would be good to have a semantic patch for that change.
> 
> >  
> > -   if (z2ram_map[z2ram_size] == 0) {
> > +   if (z2ram_map[z2ram_size] == 0)
> > break;
> > -   }
> >  
> 
> And that one.
> 
> Reason being, a semantic patch only has to be debugged once, whereas 
> manual churn has to be done correctly over and over again.

checkpatch already does this.




Re: [PATCH 17/19] z2ram: reindent

2020-08-27 Thread Finn Thain


> @@ -109,34 +111,28 @@ static void get_z2ram(void)
...
>   }
> -
> - return;
>  }
>  

It would be good to have a semantic patch for that change.

>  
> - if (z2ram_map[z2ram_size] == 0) {
> + if (z2ram_map[z2ram_size] == 0)
>   break;
> - }
>  

And that one.

Reason being, a semantic patch only has to be debugged once, whereas 
manual churn has to be done correctly over and over again.

TBH, this kind of transformation can happen when code is displayed.
It doesn't have to involve git at all. Otherwise, why have 5 billion 
transistors? You'd be better off with an Amiga.


Re: [PATCH 17/19] z2ram: reindent

2020-08-26 Thread Joe Perches
On Wed, 2020-08-26 at 11:49 +0200, John Paul Adrian Glaubitz wrote:
> > On Aug 26, 2020, at 11:21 AM, Joe Perches  wrote:
> > 
> > On Wed, 2020-08-26 at 08:24 +0200, Christoph Hellwig wrote:
> > > reindent the driver using Lident as the code style was far away from
> > > normal Linux code.
> > 
> > Why?  Does anyone use this anymore?
> 
> Yes, the Amiga and Linux/m68k is very well and alive.

That's fine.  My question was why ancient code should be modified
if it's not in use.

>  There is new hardware being developed and new drivers being developed and so 
> on.

OK, fine.

btw:

If style only changes are to be done on this code then
I believe these changes on top should also be made done
for style:
---
>From 0eb1b25575abe52415ecb0139e14ae57ba4f57cb Mon Sep 17 00:00:00 2001
Message-Id: 
<0eb1b25575abe52415ecb0139e14ae57ba4f57cb.1598453361.git@perches.com>
From: Joe Perches 
Date: Wed, 26 Aug 2020 02:20:14 -0700
Subject: [PATCH] z2ram: Use more current coding style

Use pr_fmt and pr_, continue, and remove tests against NULL.
Use more typical brace styles, add and remove them as appropriate.
Simplify logic in z2_open, rename err_out label to out, unindent a
large block by reversing the test and using goto.

Signed-off-by: Joe Perches 
---
 drivers/block/z2ram.c | 261 +++---
 1 file changed, 118 insertions(+), 143 deletions(-)

diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 566c653399d8..ea490fe4417e 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -1,7 +1,7 @@
 /*
 ** z2ram - Amiga pseudo-driver to access 16bit-RAM in ZorroII space
 ** as a block device, to be used as a RAM disk or swap space
-** 
+**
 ** Copyright (C) 1994 by Ingo Wilken (ingo.wil...@informatik.uni-oldenburg.de)
 **
 ** ++Geert: support for zorro_unused_z2ram, better range checking
@@ -25,6 +25,8 @@
 ** implied warranty.
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #define DEVICE_NAME "Z2RAM"
 
 #include 
@@ -75,7 +77,7 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx *hctx,
blk_mq_start_request(req);
 
if (start + len > z2ram_size) {
-   pr_err(DEVICE_NAME ": bad access: block=%llu, count=%u\n",
+   pr_err("bad access: block=%llu, count=%u\n",
   (unsigned long long)blk_rq_pos(req),
   blk_rq_cur_sectors(req));
return BLK_STS_IOERR;
@@ -109,34 +111,28 @@ static void get_z2ram(void)
int i;
 
for (i = 0; i < Z2RAM_SIZE / Z2RAM_CHUNKSIZE; i++) {
-   if (test_bit(i, zorro_unused_z2ram)) {
-   z2_count++;
-   z2ram_map[z2ram_size++] =
-   (unsigned long)ZTWO_VADDR(Z2RAM_START) +
-   (i << Z2RAM_CHUNKSHIFT);
-   clear_bit(i, zorro_unused_z2ram);
-   }
+   if (!test_bit(i, zorro_unused_z2ram))
+   continue;
+   z2_count++;
+   z2ram_map[z2ram_size++] =
+   (unsigned long)ZTWO_VADDR(Z2RAM_START) +
+   (i << Z2RAM_CHUNKSHIFT);
+   clear_bit(i, zorro_unused_z2ram);
}
-
-   return;
 }
 
 static void get_chipram(void)
 {
-
while (amiga_chip_avail() > (Z2RAM_CHUNKSIZE * 4)) {
chip_count++;
z2ram_map[z2ram_size] =
(u_long) amiga_chip_alloc(Z2RAM_CHUNKSIZE, "z2ram");
 
-   if (z2ram_map[z2ram_size] == 0) {
+   if (z2ram_map[z2ram_size] == 0)
break;
-   }
 
z2ram_size++;
}
-
-   return;
 }
 
 static int z2_open(struct block_device *bdev, fmode_t mode)
@@ -152,144 +148,127 @@ static int z2_open(struct block_device *bdev, fmode_t 
mode)
mutex_lock(_mutex);
if (current_device != -1 && current_device != device) {
rc = -EBUSY;
-   goto err_out;
+   goto out;
}
 
-   if (current_device == -1) {
-   z2_count = 0;
-   chip_count = 0;
-   list_count = 0;
-   z2ram_size = 0;
-
-   /* Use a specific list entry. */
-   if (device >= Z2MINOR_MEMLIST1 && device <= Z2MINOR_MEMLIST4) {
-   int index = device - Z2MINOR_MEMLIST1 + 1;
-   unsigned long size, paddr, vaddr;
-
-   if (index >= m68k_realnum_memory) {
-   printk(KERN_ERR DEVICE_NAME
-  ": no such entry in z2ram_map\n");
-   goto err_out;
-   }
+   if (current_device != -1) {
+   rc = 0;
+   goto out;
+   }
 
-   paddr = m68k_memory[index].addr;
-   size = m68k_memory[index].size & ~(Z2RAM_CHUNKSIZE - 1);
+   z2_count = 0;
+  

Re: [PATCH 17/19] z2ram: reindent

2020-08-26 Thread John Paul Adrian Glaubitz


> On Aug 26, 2020, at 11:21 AM, Joe Perches  wrote:
> 
> On Wed, 2020-08-26 at 08:24 +0200, Christoph Hellwig wrote:
>> reindent the driver using Lident as the code style was far away from
>> normal Linux code.
> 
> Why?  Does anyone use this anymore?

Yes, the Amiga and Linux/m68k is very well and alive. There is new hardware 
being developed and new drivers being developed and so on.

Please let’s don’t have another discussion about that. The code is maintained 
which is what counts and not whether any corporation is still making money with 
it.

Adrian


Re: [PATCH 17/19] z2ram: reindent

2020-08-26 Thread Joe Perches
On Wed, 2020-08-26 at 08:24 +0200, Christoph Hellwig wrote:
> reindent the driver using Lident as the code style was far away from
> normal Linux code.

Why?  Does anyone use this anymore?

 ** z2ram - Amiga pseudo-driver to access 16bit-RAM in ZorroII space
 ** as a block device, to be used as a RAM disk or swap space
 ** Copyright (C) 1994 by Ingo Wilken (ingo.wil...@informatik.uni-oldenburg.de)





[PATCH 17/19] z2ram: reindent

2020-08-26 Thread Christoph Hellwig
reindent the driver using Lident as the code style was far away from
normal Linux code.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/z2ram.c | 497 --
 1 file changed, 237 insertions(+), 260 deletions(-)

diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 0e734802ee7cc6..566c653399d8d3 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -42,7 +42,6 @@
 
 #include 
 
-
 #define Z2MINOR_COMBINED  (0)
 #define Z2MINOR_Z2ONLY(1)
 #define Z2MINOR_CHIPONLY  (2)
@@ -52,15 +51,15 @@
 #define Z2MINOR_MEMLIST4  (7)
 #define Z2MINOR_COUNT (8) /* Move this down when adding a new minor */
 
-#define Z2RAM_CHUNK1024   ( Z2RAM_CHUNKSIZE >> 10 )
+#define Z2RAM_CHUNK1024   (Z2RAM_CHUNKSIZE >> 10)
 
 static DEFINE_MUTEX(z2ram_mutex);
-static u_long *z2ram_map= NULL;
-static u_long z2ram_size= 0;
-static int z2_count = 0;
-static int chip_count   = 0;
-static int list_count   = 0;
-static int current_device   = -1;
+static u_long *z2ram_map = NULL;
+static u_long z2ram_size = 0;
+static int z2_count = 0;
+static int chip_count = 0;
+static int list_count = 0;
+static int current_device = -1;
 
 static DEFINE_SPINLOCK(z2ram_lock);
 
@@ -71,13 +70,12 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx *hctx,
 {
struct request *req = bd->rq;
unsigned long start = blk_rq_pos(req) << 9;
-   unsigned long len  = blk_rq_cur_bytes(req);
+   unsigned long len = blk_rq_cur_bytes(req);
 
blk_mq_start_request(req);
 
if (start + len > z2ram_size) {
-   pr_err(DEVICE_NAME ": bad access: block=%llu, "
-  "count=%u\n",
+   pr_err(DEVICE_NAME ": bad access: block=%llu, count=%u\n",
   (unsigned long long)blk_rq_pos(req),
   blk_rq_cur_sectors(req));
return BLK_STS_IOERR;
@@ -92,7 +90,7 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx *hctx,
 
if (len < size)
size = len;
-   addr += z2ram_map[ start >> Z2RAM_CHUNKSHIFT ];
+   addr += z2ram_map[start >> Z2RAM_CHUNKSHIFT];
if (rq_data_dir(req) == READ)
memcpy(buffer, (char *)addr, size);
else
@@ -106,228 +104,213 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx 
*hctx,
return BLK_STS_OK;
 }
 
-static void
-get_z2ram( void )
+static void get_z2ram(void)
 {
-int i;
-
-for ( i = 0; i < Z2RAM_SIZE / Z2RAM_CHUNKSIZE; i++ )
-{
-   if ( test_bit( i, zorro_unused_z2ram ) )
-   {
-   z2_count++;
-   z2ram_map[z2ram_size++] = (unsigned long)ZTWO_VADDR(Z2RAM_START) +
- (i << Z2RAM_CHUNKSHIFT);
-   clear_bit( i, zorro_unused_z2ram );
+   int i;
+
+   for (i = 0; i < Z2RAM_SIZE / Z2RAM_CHUNKSIZE; i++) {
+   if (test_bit(i, zorro_unused_z2ram)) {
+   z2_count++;
+   z2ram_map[z2ram_size++] =
+   (unsigned long)ZTWO_VADDR(Z2RAM_START) +
+   (i << Z2RAM_CHUNKSHIFT);
+   clear_bit(i, zorro_unused_z2ram);
+   }
}
-}
 
-return;
+   return;
 }
 
-static void
-get_chipram( void )
+static void get_chipram(void)
 {
 
-while ( amiga_chip_avail() > ( Z2RAM_CHUNKSIZE * 4 ) )
-{
-   chip_count++;
-   z2ram_map[ z2ram_size ] =
-   (u_long)amiga_chip_alloc( Z2RAM_CHUNKSIZE, "z2ram" );
+   while (amiga_chip_avail() > (Z2RAM_CHUNKSIZE * 4)) {
+   chip_count++;
+   z2ram_map[z2ram_size] =
+   (u_long) amiga_chip_alloc(Z2RAM_CHUNKSIZE, "z2ram");
 
-   if ( z2ram_map[ z2ram_size ] == 0 )
-   {
-   break;
+   if (z2ram_map[z2ram_size] == 0) {
+   break;
+   }
+
+   z2ram_size++;
}
 
-   z2ram_size++;
-}
-   
-return;
+   return;
 }
 
 static int z2_open(struct block_device *bdev, fmode_t mode)
 {
-int device;
-int max_z2_map = ( Z2RAM_SIZE / Z2RAM_CHUNKSIZE ) *
-   sizeof( z2ram_map[0] );
-int max_chip_map = ( amiga_chip_size / Z2RAM_CHUNKSIZE ) *
-   sizeof( z2ram_map[0] );
-int rc = -ENOMEM;
-
-device = MINOR(bdev->bd_dev);
-
-mutex_lock(_mutex);
-if ( current_device != -1 && current_device != device )
-{
-   rc = -EBUSY;
-   goto err_out;
-}
-
-if ( current_device == -1 )
-{
-   z2_count   = 0;
-   chip_count = 0;
-   list_count = 0;
-   z2ram_size = 0;
-
-   /* Use a specific list entry. */
-   if (device >= Z2MINOR_MEMLIST1 && device <= Z2MINOR_MEMLIST4) {
-   int index = device - Z2MINOR_MEMLIST1 + 1;
-   unsigned long size, paddr, vaddr;
-
-   if (index >= m68k_realnum_memory) {
-