Commit 6c3a05e1 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

z2ram: reindent

reindent the driver using Lident as the code style was far away from
normal Linux code.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent bf9c0538
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include <linux/zorro.h> #include <linux/zorro.h>
#define Z2MINOR_COMBINED (0) #define Z2MINOR_COMBINED (0)
#define Z2MINOR_Z2ONLY (1) #define Z2MINOR_Z2ONLY (1)
#define Z2MINOR_CHIPONLY (2) #define Z2MINOR_CHIPONLY (2)
...@@ -92,7 +91,7 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -92,7 +91,7 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx *hctx,
if (len < size) if (len < size)
size = len; size = len;
addr += z2ram_map[ start >> Z2RAM_CHUNKSHIFT ]; addr += z2ram_map[start >> Z2RAM_CHUNKSHIFT];
if (rq_data_dir(req) == READ) if (rq_data_dir(req) == READ)
memcpy(buffer, (char *)addr, size); memcpy(buffer, (char *)addr, size);
else else
...@@ -106,37 +105,32 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -106,37 +105,32 @@ static blk_status_t z2_queue_rq(struct blk_mq_hw_ctx *hctx,
return BLK_STS_OK; return BLK_STS_OK;
} }
static void static void get_z2ram(void)
get_z2ram( void )
{ {
int i; int i;
for ( i = 0; i < Z2RAM_SIZE / Z2RAM_CHUNKSIZE; i++ ) for (i = 0; i < Z2RAM_SIZE / Z2RAM_CHUNKSIZE; i++) {
{ if (test_bit(i, zorro_unused_z2ram)) {
if ( test_bit( i, zorro_unused_z2ram ) )
{
z2_count++; z2_count++;
z2ram_map[z2ram_size++] = (unsigned long)ZTWO_VADDR(Z2RAM_START) + z2ram_map[z2ram_size++] =
(unsigned long)ZTWO_VADDR(Z2RAM_START) +
(i << Z2RAM_CHUNKSHIFT); (i << Z2RAM_CHUNKSHIFT);
clear_bit( i, zorro_unused_z2ram ); clear_bit(i, zorro_unused_z2ram);
} }
} }
return; return;
} }
static void static void get_chipram(void)
get_chipram( void )
{ {
while ( amiga_chip_avail() > ( Z2RAM_CHUNKSIZE * 4 ) ) while (amiga_chip_avail() > (Z2RAM_CHUNKSIZE * 4)) {
{
chip_count++; chip_count++;
z2ram_map[ z2ram_size ] = z2ram_map[z2ram_size] =
(u_long)amiga_chip_alloc( Z2RAM_CHUNKSIZE, "z2ram" ); (u_long) amiga_chip_alloc(Z2RAM_CHUNKSIZE, "z2ram");
if ( z2ram_map[ z2ram_size ] == 0 ) if (z2ram_map[z2ram_size] == 0) {
{
break; break;
} }
...@@ -149,23 +143,20 @@ get_chipram( void ) ...@@ -149,23 +143,20 @@ get_chipram( void )
static int z2_open(struct block_device *bdev, fmode_t mode) static int z2_open(struct block_device *bdev, fmode_t mode)
{ {
int device; int device;
int max_z2_map = ( Z2RAM_SIZE / Z2RAM_CHUNKSIZE ) * int max_z2_map = (Z2RAM_SIZE / Z2RAM_CHUNKSIZE) * sizeof(z2ram_map[0]);
sizeof( z2ram_map[0] ); int max_chip_map = (amiga_chip_size / Z2RAM_CHUNKSIZE) *
int max_chip_map = ( amiga_chip_size / Z2RAM_CHUNKSIZE ) * sizeof(z2ram_map[0]);
sizeof( z2ram_map[0] );
int rc = -ENOMEM; int rc = -ENOMEM;
device = MINOR(bdev->bd_dev); device = MINOR(bdev->bd_dev);
mutex_lock(&z2ram_mutex); mutex_lock(&z2ram_mutex);
if ( current_device != -1 && current_device != device ) if (current_device != -1 && current_device != device) {
{
rc = -EBUSY; rc = -EBUSY;
goto err_out; goto err_out;
} }
if ( current_device == -1 ) if (current_device == -1) {
{
z2_count = 0; z2_count = 0;
chip_count = 0; chip_count = 0;
list_count = 0; list_count = 0;
...@@ -177,106 +168,103 @@ static int z2_open(struct block_device *bdev, fmode_t mode) ...@@ -177,106 +168,103 @@ static int z2_open(struct block_device *bdev, fmode_t mode)
unsigned long size, paddr, vaddr; unsigned long size, paddr, vaddr;
if (index >= m68k_realnum_memory) { if (index >= m68k_realnum_memory) {
printk( KERN_ERR DEVICE_NAME printk(KERN_ERR DEVICE_NAME
": no such entry in z2ram_map\n" ); ": no such entry in z2ram_map\n");
goto err_out; goto err_out;
} }
paddr = m68k_memory[index].addr; paddr = m68k_memory[index].addr;
size = m68k_memory[index].size & ~(Z2RAM_CHUNKSIZE-1); size = m68k_memory[index].size & ~(Z2RAM_CHUNKSIZE - 1);
#ifdef __powerpc__ #ifdef __powerpc__
/* FIXME: ioremap doesn't build correct memory tables. */ /* FIXME: ioremap doesn't build correct memory tables. */
{ {
vfree(vmalloc (size)); vfree(vmalloc(size));
} }
vaddr = (unsigned long)ioremap_wt(paddr, size); vaddr = (unsigned long)ioremap_wt(paddr, size);
#else #else
vaddr = (unsigned long)z_remap_nocache_nonser(paddr, size); vaddr =
(unsigned long)z_remap_nocache_nonser(paddr, size);
#endif #endif
z2ram_map = z2ram_map =
kmalloc_array(size / Z2RAM_CHUNKSIZE, kmalloc_array(size / Z2RAM_CHUNKSIZE,
sizeof(z2ram_map[0]), sizeof(z2ram_map[0]), GFP_KERNEL);
GFP_KERNEL); if (z2ram_map == NULL) {
if ( z2ram_map == NULL ) printk(KERN_ERR DEVICE_NAME
{ ": cannot get mem for z2ram_map\n");
printk( KERN_ERR DEVICE_NAME
": cannot get mem for z2ram_map\n" );
goto err_out; goto err_out;
} }
while (size) { while (size) {
z2ram_map[ z2ram_size++ ] = vaddr; z2ram_map[z2ram_size++] = vaddr;
size -= Z2RAM_CHUNKSIZE; size -= Z2RAM_CHUNKSIZE;
vaddr += Z2RAM_CHUNKSIZE; vaddr += Z2RAM_CHUNKSIZE;
list_count++; list_count++;
} }
if ( z2ram_size != 0 ) if (z2ram_size != 0)
printk( KERN_INFO DEVICE_NAME printk(KERN_INFO DEVICE_NAME
": using %iK List Entry %d Memory\n", ": using %iK List Entry %d Memory\n",
list_count * Z2RAM_CHUNK1024, index ); list_count * Z2RAM_CHUNK1024, index);
} else } else
switch (device) {
switch ( device )
{
case Z2MINOR_COMBINED: case Z2MINOR_COMBINED:
z2ram_map = kmalloc( max_z2_map + max_chip_map, GFP_KERNEL ); z2ram_map =
if ( z2ram_map == NULL ) kmalloc(max_z2_map + max_chip_map,
{ GFP_KERNEL);
printk( KERN_ERR DEVICE_NAME if (z2ram_map == NULL) {
": cannot get mem for z2ram_map\n" ); printk(KERN_ERR DEVICE_NAME
": cannot get mem for z2ram_map\n");
goto err_out; goto err_out;
} }
get_z2ram(); get_z2ram();
get_chipram(); get_chipram();
if ( z2ram_size != 0 ) if (z2ram_size != 0)
printk( KERN_INFO DEVICE_NAME printk(KERN_INFO DEVICE_NAME
": using %iK Zorro II RAM and %iK Chip RAM (Total %dK)\n", ": using %iK Zorro II RAM and %iK Chip RAM (Total %dK)\n",
z2_count * Z2RAM_CHUNK1024, z2_count * Z2RAM_CHUNK1024,
chip_count * Z2RAM_CHUNK1024, chip_count * Z2RAM_CHUNK1024,
( z2_count + chip_count ) * Z2RAM_CHUNK1024 ); (z2_count +
chip_count) * Z2RAM_CHUNK1024);
break; break;
case Z2MINOR_Z2ONLY: case Z2MINOR_Z2ONLY:
z2ram_map = kmalloc( max_z2_map, GFP_KERNEL ); z2ram_map = kmalloc(max_z2_map, GFP_KERNEL);
if ( z2ram_map == NULL ) if (z2ram_map == NULL) {
{ printk(KERN_ERR DEVICE_NAME
printk( KERN_ERR DEVICE_NAME ": cannot get mem for z2ram_map\n");
": cannot get mem for z2ram_map\n" );
goto err_out; goto err_out;
} }
get_z2ram(); get_z2ram();
if ( z2ram_size != 0 ) if (z2ram_size != 0)
printk( KERN_INFO DEVICE_NAME printk(KERN_INFO DEVICE_NAME
": using %iK of Zorro II RAM\n", ": using %iK of Zorro II RAM\n",
z2_count * Z2RAM_CHUNK1024 ); z2_count * Z2RAM_CHUNK1024);
break; break;
case Z2MINOR_CHIPONLY: case Z2MINOR_CHIPONLY:
z2ram_map = kmalloc( max_chip_map, GFP_KERNEL ); z2ram_map = kmalloc(max_chip_map, GFP_KERNEL);
if ( z2ram_map == NULL ) if (z2ram_map == NULL) {
{ printk(KERN_ERR DEVICE_NAME
printk( KERN_ERR DEVICE_NAME ": cannot get mem for z2ram_map\n");
": cannot get mem for z2ram_map\n" );
goto err_out; goto err_out;
} }
get_chipram(); get_chipram();
if ( z2ram_size != 0 ) if (z2ram_size != 0)
printk( KERN_INFO DEVICE_NAME printk(KERN_INFO DEVICE_NAME
": using %iK Chip RAM\n", ": using %iK Chip RAM\n",
chip_count * Z2RAM_CHUNK1024 ); chip_count * Z2RAM_CHUNK1024);
break; break;
...@@ -287,10 +275,9 @@ static int z2_open(struct block_device *bdev, fmode_t mode) ...@@ -287,10 +275,9 @@ static int z2_open(struct block_device *bdev, fmode_t mode)
break; break;
} }
if ( z2ram_size == 0 ) if (z2ram_size == 0) {
{ printk(KERN_NOTICE DEVICE_NAME
printk( KERN_NOTICE DEVICE_NAME ": no unused ZII/Chip RAM found\n");
": no unused ZII/Chip RAM found\n" );
goto err_out_kfree; goto err_out_kfree;
} }
...@@ -309,11 +296,10 @@ static int z2_open(struct block_device *bdev, fmode_t mode) ...@@ -309,11 +296,10 @@ static int z2_open(struct block_device *bdev, fmode_t mode)
return rc; return rc;
} }
static void static void z2_release(struct gendisk *disk, fmode_t mode)
z2_release(struct gendisk *disk, fmode_t mode)
{ {
mutex_lock(&z2ram_mutex); mutex_lock(&z2ram_mutex);
if ( current_device == -1 ) { if (current_device == -1) {
mutex_unlock(&z2ram_mutex); mutex_unlock(&z2ram_mutex);
return; return;
} }
...@@ -323,8 +309,7 @@ z2_release(struct gendisk *disk, fmode_t mode) ...@@ -323,8 +309,7 @@ z2_release(struct gendisk *disk, fmode_t mode)
*/ */
} }
static const struct block_device_operations z2_fops = static const struct block_device_operations z2_fops = {
{
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = z2_open, .open = z2_open,
.release = z2_release, .release = z2_release,
...@@ -343,8 +328,7 @@ static const struct blk_mq_ops z2_mq_ops = { ...@@ -343,8 +328,7 @@ static const struct blk_mq_ops z2_mq_ops = {
.queue_rq = z2_queue_rq, .queue_rq = z2_queue_rq,
}; };
static int __init static int __init z2_init(void)
z2_init(void)
{ {
int ret; int ret;
...@@ -398,26 +382,21 @@ static void __exit z2_exit(void) ...@@ -398,26 +382,21 @@ static void __exit z2_exit(void)
blk_cleanup_queue(z2_queue); blk_cleanup_queue(z2_queue);
blk_mq_free_tag_set(&tag_set); blk_mq_free_tag_set(&tag_set);
if ( current_device != -1 ) if (current_device != -1) {
{
i = 0; i = 0;
for ( j = 0 ; j < z2_count; j++ ) for (j = 0; j < z2_count; j++) {
{ set_bit(i++, zorro_unused_z2ram);
set_bit( i++, zorro_unused_z2ram );
} }
for ( j = 0 ; j < chip_count; j++ ) for (j = 0; j < chip_count; j++) {
{ if (z2ram_map[i]) {
if ( z2ram_map[ i ] ) amiga_chip_free((void *)z2ram_map[i++]);
{
amiga_chip_free( (void *) z2ram_map[ i++ ] );
} }
} }
if ( z2ram_map != NULL ) if (z2ram_map != NULL) {
{ kfree(z2ram_map);
kfree( z2ram_map );
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment