Commit 2b61d5c1 authored by Mika Kukkonen's avatar Mika Kukkonen Committed by Linus Torvalds

[PATCH] sparse: NULL vs 0 - rest of drivers

parent d2493ae5
......@@ -110,7 +110,7 @@ dma_pool_create (const char *name, struct device *dev,
if (align == 0)
align = 1;
if (size == 0)
return 0;
return NULL;
else if (size < align)
size = align;
else if ((size % align) != 0) {
......@@ -125,7 +125,7 @@ dma_pool_create (const char *name, struct device *dev,
allocation = PAGE_SIZE;
// FIXME: round up for less fragmentation
} else if (allocation < size)
return 0;
return NULL;
if (!(retval = kmalloc (sizeof *retval, SLAB_KERNEL)))
return retval;
......@@ -167,7 +167,7 @@ pool_alloc_page (struct dma_pool *pool, int mem_flags)
page = (struct dma_page *) kmalloc (mapsize + sizeof *page, mem_flags);
if (!page)
return 0;
return NULL;
page->vaddr = dma_alloc_coherent (pool->dev,
pool->allocation,
&page->dma,
......@@ -181,7 +181,7 @@ pool_alloc_page (struct dma_pool *pool, int mem_flags)
page->in_use = 0;
} else {
kfree (page);
page = 0;
page = NULL;
}
return page;
}
......@@ -302,7 +302,7 @@ dma_pool_alloc (struct dma_pool *pool, int mem_flags, dma_addr_t *handle)
remove_wait_queue (&pool->waitq, &wait);
goto restart;
}
retval = 0;
retval = NULL;
goto done;
}
......@@ -334,7 +334,7 @@ pool_find_page (struct dma_pool *pool, dma_addr_t dma)
if (dma < (page->dma + pool->allocation))
goto done;
}
page = 0;
page = NULL;
done:
spin_unlock_irqrestore (&pool->lock, flags);
return page;
......
......@@ -196,7 +196,7 @@ __cfq_add_crq_rb(struct cfq_queue *cfqq, struct cfq_rq *crq)
}
rb_link_node(&crq->rb_node, parent, p);
return 0;
return NULL;
}
static void
......
......@@ -205,7 +205,7 @@ __deadline_add_drq_rb(struct deadline_data *dd, struct deadline_rq *drq)
}
rb_link_node(&drq->rb_node, parent, p);
return 0;
return NULL;
}
static void
......
......@@ -922,7 +922,7 @@ static inline void unlock_fdc(void)
{
unsigned long flags;
raw_cmd = 0;
raw_cmd = NULL;
if (!test_bit(0, &fdc_busy))
DPRINT("FDC access conflict!\n");
......@@ -2021,7 +2021,7 @@ static void floppy_start(void)
static void do_wakeup(void)
{
reschedule_timeout(MAXTIMEOUT, "do wakeup", 0);
cont = 0;
cont = NULL;
command_status += 2;
wake_up(&command_done);
}
......@@ -3191,7 +3191,7 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr)
struct floppy_raw_cmd *next, *this;
this = *ptr;
*ptr = 0;
*ptr = NULL;
while (this) {
if (this->buffer_length) {
fd_dma_mem_free((unsigned long)this->kernel_data,
......@@ -3211,7 +3211,7 @@ static inline int raw_cmd_copyin(int cmd, char __user *param,
int ret;
int i;
*rcmd = 0;
*rcmd = NULL;
while (1) {
ptr = (struct floppy_raw_cmd *)
kmalloc(sizeof(struct floppy_raw_cmd), GFP_USER);
......@@ -3219,7 +3219,7 @@ static inline int raw_cmd_copyin(int cmd, char __user *param,
return -ENOMEM;
*rcmd = ptr;
COPYIN(*ptr);
ptr->next = 0;
ptr->next = NULL;
ptr->buffer_length = 0;
param += sizeof(struct floppy_raw_cmd);
if (ptr->cmd_count > 33)
......@@ -3236,7 +3236,7 @@ static inline int raw_cmd_copyin(int cmd, char __user *param,
for (i = 0; i < 16; i++)
ptr->reply[i] = 0;
ptr->resultcode = 0;
ptr->kernel_data = 0;
ptr->kernel_data = NULL;
if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) {
if (ptr->length <= 0)
......@@ -4125,32 +4125,32 @@ static struct param_table {
int def_param;
int param2;
} config_params[] = {
{"allowed_drive_mask", 0, &allowed_drive_mask, 0xff, 0}, /* obsolete */
{"all_drives", 0, &allowed_drive_mask, 0xff, 0}, /* obsolete */
{"asus_pci", 0, &allowed_drive_mask, 0x33, 0},
{"irq", 0, &FLOPPY_IRQ, 6, 0},
{"dma", 0, &FLOPPY_DMA, 2, 0},
{"daring", daring, 0, 1, 0},
{"allowed_drive_mask", NULL, &allowed_drive_mask, 0xff, 0}, /* obsolete */
{"all_drives", NULL, &allowed_drive_mask, 0xff, 0}, /* obsolete */
{"asus_pci", NULL, &allowed_drive_mask, 0x33, 0},
{"irq", NULL, &FLOPPY_IRQ, 6, 0},
{"dma", NULL, &FLOPPY_DMA, 2, 0},
{"daring", daring, NULL, 1, 0},
#if N_FDC > 1
{"two_fdc", 0, &FDC2, 0x370, 0},
{"one_fdc", 0, &FDC2, 0, 0},
{"two_fdc", NULL, &FDC2, 0x370, 0},
{"one_fdc", NULL, &FDC2, 0, 0},
#endif
{"thinkpad", floppy_set_flags, 0, 1, FD_INVERTED_DCL},
{"broken_dcl", floppy_set_flags, 0, 1, FD_BROKEN_DCL},
{"messages", floppy_set_flags, 0, 1, FTD_MSG},
{"silent_dcl_clear", floppy_set_flags, 0, 1, FD_SILENT_DCL_CLEAR},
{"debug", floppy_set_flags, 0, 1, FD_DEBUG},
{"nodma", 0, &can_use_virtual_dma, 1, 0},
{"omnibook", 0, &can_use_virtual_dma, 1, 0},
{"yesdma", 0, &can_use_virtual_dma, 0, 0},
{"fifo_depth", 0, &fifo_depth, 0xa, 0},
{"nofifo", 0, &no_fifo, 0x20, 0},
{"usefifo", 0, &no_fifo, 0, 0},
{"cmos", set_cmos, 0, 0, 0},
{"slow", 0, &slow_floppy, 1, 0},
{"unexpected_interrupts", 0, &print_unex, 1, 0},
{"no_unexpected_interrupts", 0, &print_unex, 0, 0},
{"L40SX", 0, &print_unex, 0, 0}
{"thinkpad", floppy_set_flags, NULL, 1, FD_INVERTED_DCL},
{"broken_dcl", floppy_set_flags, NULL, 1, FD_BROKEN_DCL},
{"messages", floppy_set_flags, NULL, 1, FTD_MSG},
{"silent_dcl_clear", floppy_set_flags, NULL, 1, FD_SILENT_DCL_CLEAR},
{"debug", floppy_set_flags, NULL, 1, FD_DEBUG},
{"nodma", NULL, &can_use_virtual_dma, 1, 0},
{"omnibook", NULL, &can_use_virtual_dma, 1, 0},
{"yesdma", NULL, &can_use_virtual_dma, 0, 0},
{"fifo_depth", NULL, &fifo_depth, 0xa, 0},
{"nofifo", NULL, &no_fifo, 0x20, 0},
{"usefifo", NULL, &no_fifo, 0, 0},
{"cmos", set_cmos, NULL, 0, 0},
{"slow", NULL, &slow_floppy, 1, 0},
{"unexpected_interrupts", NULL, &print_unex, 1, 0},
{"no_unexpected_interrupts", NULL, &print_unex, 0, 0},
{"L40SX", NULL, &print_unex, 0, 0}
EXTRA_FLOPPY_PARAMS
};
......
......@@ -90,7 +90,7 @@ int register_blkdev(unsigned int major, const char *name)
p->major = major;
strlcpy(p->name, name, sizeof(p->name));
p->next = 0;
p->next = NULL;
index = major_to_index(major);
spin_lock_irqsave(&major_names_lock, flags);
......
......@@ -100,7 +100,7 @@ static const struct drive_list_entry drive_whitelist [] = {
{ "CONNER CTMA 4000" , "ALL" },
{ "CONNER CTT8000-A" , "ALL" },
{ "ST34342A" , "ALL" },
{ 0 , 0 }
{ NULL , NULL }
};
static const struct drive_list_entry drive_blacklist [] = {
......@@ -138,7 +138,7 @@ static const struct drive_list_entry drive_blacklist [] = {
{ "PLEXTOR CD-R PX-W8432T", "ALL" },
{ "ATAPI CD-ROM DRIVE 40X MAXIMUM", "ALL" },
{ "_NEC DV5800A", "ALL" },
{ 0 , 0 }
{ NULL , NULL }
};
......
......@@ -790,5 +790,5 @@ void proc_ide_destroy(void)
{
remove_proc_entry("ide/drivers", proc_ide_root);
destroy_proc_ide_interfaces();
remove_proc_entry("ide", 0);
remove_proc_entry("ide", NULL);
}
......@@ -2320,7 +2320,7 @@ int __init ide_init (void)
init_ide_data();
#ifdef CONFIG_PROC_FS
proc_ide_root = proc_mkdir("ide", 0);
proc_ide_root = proc_mkdir("ide", NULL);
#endif
#ifdef CONFIG_BLK_DEV_ALI14XX
......
......@@ -1075,7 +1075,7 @@ do { \
#undef PUT_ENVP
envp[i] = 0;
envp[i] = NULL;
return 0;
}
......
......@@ -369,7 +369,7 @@ static void input_call_hotplug(char *verb, struct input_dev *dev)
argv[0] = hotplug_path;
argv[1] = "input";
argv[2] = 0;
argv[2] = NULL;
envp[i++] = "HOME=/";
envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
......@@ -402,7 +402,7 @@ static void input_call_hotplug(char *verb, struct input_dev *dev)
SPRINTF_BIT_A2(sndbit, "SND=", SND_MAX, EV_SND);
SPRINTF_BIT_A2(ffbit, "FF=", FF_MAX, EV_FF);
envp[i++] = 0;
envp[i++] = NULL;
#ifdef INPUT_DEBUG
printk(KERN_DEBUG "input.c: calling %s %s [%s %s %s %s %s]\n",
......
......@@ -35,7 +35,7 @@
#define DEFAULT_EXPIRE (HZ / 4)
static void wq_sync_buffers(void *);
static DECLARE_WORK(sync_wq, wq_sync_buffers, 0);
static DECLARE_WORK(sync_wq, wq_sync_buffers, NULL);
static struct timer_list sync_timer;
static void timer_ping(unsigned long data);
......@@ -425,7 +425,7 @@ static void increment_tail(struct oprofile_cpu_buffer * b)
*/
static void sync_buffer(struct oprofile_cpu_buffer * cpu_buf)
{
struct mm_struct * mm = 0;
struct mm_struct *mm = NULL;
struct task_struct * new;
unsigned long cookie = 0;
int in_kernel = 1;
......
......@@ -57,7 +57,7 @@ int alloc_cpu_buffers(void)
if (!b->buffer)
goto fail;
b->last_task = 0;
b->last_task = NULL;
b->last_is_kernel = -1;
b->buffer_size = buffer_size;
b->tail_pos = 0;
......@@ -176,5 +176,5 @@ void cpu_buffer_reset(struct oprofile_cpu_buffer * cpu_buf)
* values to initialize the buffer
*/
cpu_buf->last_is_kernel = -1;
cpu_buf->last_task = 0;
cpu_buf->last_task = NULL;
}
......@@ -176,11 +176,11 @@ static struct dentry * __oprofilefs_create_file(struct super_block * sb,
qname.hash = full_name_hash(qname.name, qname.len);
dentry = d_alloc(root, &qname);
if (!dentry)
return 0;
return NULL;
inode = oprofilefs_get_inode(sb, S_IFREG | perm);
if (!inode) {
dput(dentry);
return 0;
return NULL;
}
inode->i_fop = fops;
d_add(dentry, inode);
......@@ -269,11 +269,11 @@ struct dentry * oprofilefs_mkdir(struct super_block * sb,
qname.hash = full_name_hash(qname.name, qname.len);
dentry = d_alloc(root, &qname);
if (!dentry)
return 0;
return NULL;
inode = oprofilefs_get_inode(sb, S_IFDIR | 0755);
if (!inode) {
dput(dentry);
return 0;
return NULL;
}
inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
......
......@@ -2147,7 +2147,7 @@ struct parport *parport_pc_probe_port (unsigned long int base,
priv->ctr_writable = ~0x10;
priv->ecr = 0;
priv->fifo_depth = 0;
priv->dma_buf = 0;
priv->dma_buf = NULL;
priv->dma_handle = 0;
priv->dev = dev;
INIT_LIST_HEAD(&priv->list);
......
......@@ -59,7 +59,7 @@ int pci_hotplug (struct device *dev, char **envp, int num_envp,
if ((buffer_size - length <= 0) || (i >= num_envp))
return -ENOMEM;
envp[i] = 0;
envp[i] = NULL;
return 0;
}
......
......@@ -837,7 +837,7 @@ static void adpt_i2o_sys_shutdown(void)
kfree(p1);
}
// spin_unlock_irqrestore(&adpt_post_wait_lock, flags);
adpt_post_wait_queue = 0;
adpt_post_wait_queue = NULL;
printk(KERN_INFO "Adaptec I2O controllers down.\n");
}
......
......@@ -492,7 +492,7 @@ void scsi_exit_devinfo(void)
struct scsi_dev_info_list *devinfo;
#ifdef CONFIG_SCSI_PROC_FS
remove_proc_entry("scsi/device_info", 0);
remove_proc_entry("scsi/device_info", NULL);
#endif
list_for_each_safe(lh, lh_next, &scsi_dev_info_list) {
......
......@@ -312,7 +312,7 @@ int __init scsi_init_procfs(void)
{
struct proc_dir_entry *pde;
proc_scsi = proc_mkdir("scsi", 0);
proc_scsi = proc_mkdir("scsi", NULL);
if (!proc_scsi)
goto err1;
......@@ -324,13 +324,13 @@ int __init scsi_init_procfs(void)
return 0;
err2:
remove_proc_entry("scsi", 0);
remove_proc_entry("scsi", NULL);
err1:
return -ENOMEM;
}
void scsi_exit_procfs(void)
{
remove_proc_entry("scsi/scsi", 0);
remove_proc_entry("scsi", 0);
remove_proc_entry("scsi/scsi", NULL);
remove_proc_entry("scsi", NULL);
}
......@@ -625,4 +625,4 @@ int scsi_sysfs_add_host(struct Scsi_Host *shost)
/* A blank transport template that is used in drivers that don't
* yet implement Transport Attributes */
struct scsi_transport_template blank_transport_template = { 0, };
struct scsi_transport_template blank_transport_template = { NULL, };
......@@ -2404,7 +2404,7 @@ sg_add_sfp(Sg_device * sdp, int dev)
Sg_fd *sfp;
unsigned long iflags;
sfp = (Sg_fd *) sg_page_malloc(sizeof (Sg_fd), 0, 0);
sfp = (Sg_fd *) sg_page_malloc(sizeof (Sg_fd), 0, NULL);
if (!sfp)
return NULL;
memset(sfp, 0, sizeof (Sg_fd));
......@@ -2814,7 +2814,7 @@ sg_proc_write_adio(struct file *filp, const char __user *buffer,
if (copy_from_user(buff, buffer, num))
return -EFAULT;
buff[num] = '\0';
sg_allow_dio = simple_strtoul(buff, 0, 10) ? 1 : 0;
sg_allow_dio = simple_strtoul(buff, NULL, 10) ? 1 : 0;
return count;
}
......@@ -2837,7 +2837,7 @@ sg_proc_write_dressz(struct file *filp, const char __user *buffer,
if (copy_from_user(buff, buffer, num))
return -EFAULT;
buff[num] = '\0';
k = simple_strtoul(buff, 0, 10);
k = simple_strtoul(buff, NULL, 10);
if (k <= 1048576) { /* limit "big buff" to 1 MB */
sg_big_buff = k;
return count;
......
......@@ -497,7 +497,7 @@ static struct timedia_struct {
{ 2, timedia_dual_port },
{ 4, timedia_quad_port },
{ 8, timedia_eight_port },
{ 0, 0 }
{ 0, NULL }
};
static int __devinit pci_timedia_init(struct pci_dev *dev)
......
......@@ -334,7 +334,7 @@ static char *modem_names[] __devinitdata = {
"MODEM", "Modem", "modem", "FAX", "Fax", "fax",
"56K", "56k", "K56", "33.6", "28.8", "14.4",
"33,600", "28,800", "14,400", "33.600", "28.800", "14.400",
"33600", "28800", "14400", "V.90", "V.34", "V.32", 0
"33600", "28800", "14400", "V.90", "V.34", "V.32", NULL
};
static int __devinit check_name(char *name)
......
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