Skip to content

Commit

Permalink
Add "no BKL needed" comments to several drivers
Browse files Browse the repository at this point in the history
This documents the fact that somebody looked at the relevant open()
functions and concluded that, due to their trivial nature, no locking was
needed.

Signed-off-by: Jonathan Corbet <[email protected]>
  • Loading branch information
Jonathan Corbet committed Jun 20, 2008
1 parent 39d95b9 commit d21c95c
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion arch/cris/arch-v10/drivers/eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ int __init eeprom_init(void)
}

/* Opens the device. */

/* BKL not needed: no global resources accessed */
static int eeprom_open(struct inode * inode, struct file * file)
{

Expand Down
2 changes: 1 addition & 1 deletion arch/cris/arch-v32/drivers/cryptocop.c
Original file line number Diff line number Diff line change
Expand Up @@ -2302,7 +2302,7 @@ static int cryptocop_job_setup(struct cryptocop_prio_job **pj, struct cryptocop_
return 0;
}


/* No BKL needed here - no global resources accessed */
static int cryptocop_open(struct inode *inode, struct file *filp)
{
int p = iminor(inode);
Expand Down
2 changes: 2 additions & 0 deletions drivers/char/cs5535_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ static ssize_t cs5535_gpio_read(struct file *file, char __user *buf,
return count;
}

/* No BKL needed here - "mask" is the only global resource used
here and it's a boot-time parameter */
static int cs5535_gpio_open(struct inode *inode, struct file *file)
{
u32 m = iminor(inode);
Expand Down
2 changes: 2 additions & 0 deletions drivers/char/dtlk.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ static int dtlk_ioctl(struct inode *inode,
}
}

/* No BKL needed here; "dtlk_busy" is the only global resource,
and it is not ever set by anybody (test is broken) */
static int dtlk_open(struct inode *inode, struct file *file)
{
TRACE_TEXT("(dtlk_open");
Expand Down
1 change: 1 addition & 0 deletions drivers/char/pc8736x_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ static struct nsc_gpio_ops pc8736x_gpio_ops = {
.gpio_current = pc8736x_gpio_current
};

/* No BKL needed here; no global resources accessed */
static int pc8736x_gpio_open(struct inode *inode, struct file *file)
{
unsigned m = iminor(inode);
Expand Down
1 change: 1 addition & 0 deletions drivers/char/ppdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ static int pp_ioctl(struct inode *inode, struct file *file,
return 0;
}

/* No BKL needed here: only local resources used */
static int pp_open (struct inode * inode, struct file * file)
{
unsigned int minor = iminor(inode);
Expand Down
1 change: 1 addition & 0 deletions drivers/char/scx200_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct nsc_gpio_ops scx200_gpio_ops = {
};
EXPORT_SYMBOL_GPL(scx200_gpio_ops);

/* No BKL needed here: no global resources used */
static int scx200_gpio_open(struct inode *inode, struct file *file)
{
unsigned m = iminor(inode);
Expand Down
1 change: 1 addition & 0 deletions drivers/char/tb0219.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ static ssize_t tanbac_tb0219_write(struct file *file, const char __user *data,
return i;
}

/* No BKL needed here; no global resources accessed */
static int tanbac_tb0219_open(struct inode *inode, struct file *file)
{
unsigned int minor;
Expand Down
2 changes: 2 additions & 0 deletions drivers/char/vr41xx_giu.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,8 @@ static ssize_t gpio_write(struct file *file, const char __user *data,
return i;
}

/* No BKL needed here; only global (giu_nr_pins) is only set
at probe time */
static int gpio_open(struct inode *inode, struct file *file)
{
unsigned int pin;
Expand Down
1 change: 1 addition & 0 deletions drivers/infiniband/core/ucm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,7 @@ static unsigned int ib_ucm_poll(struct file *filp,
return mask;
}

/* No BKL needed here: no global resources used */
static int ib_ucm_open(struct inode *inode, struct file *filp)
{
struct ib_ucm_file *file;
Expand Down
1 change: 1 addition & 0 deletions drivers/infiniband/hw/ipath/ipath_file_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,7 @@ static int find_shared_port(struct file *fp,
return ret;
}

/* No BKL needed here */
static int ipath_open(struct inode *in, struct file *fp)
{
/* The real work is performed later in ipath_assign_port() */
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ppp_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ static const int npindex_to_ethertype[NUM_NP] = {
* Open instances of /dev/ppp can be in one of three states:
* unattached, attached to a ppp unit, or attached to a ppp channel.
*/
/* No BKL needed here */
static int ppp_open(struct inode *inode, struct file *file)
{
/*
Expand Down
2 changes: 2 additions & 0 deletions drivers/scsi/3w-9xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,8 @@ static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
} /* End twa_chrdev_ioctl() */

/* This function handles open for the character device */
/* NOTE that this function will race with remove; adding BKL
will not help. */
static int twa_chrdev_open(struct inode *inode, struct file *file)
{
unsigned int minor_number;
Expand Down
2 changes: 2 additions & 0 deletions drivers/scsi/3w-xxxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,8 @@ static int tw_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int
} /* End tw_chrdev_ioctl() */

/* This function handles open for the character device */
/* NOTE that this function races with remove - adding BKL
won't help */
static int tw_chrdev_open(struct inode *inode, struct file *file)
{
unsigned int minor_number;
Expand Down
5 changes: 3 additions & 2 deletions drivers/scsi/megaraid.c
Original file line number Diff line number Diff line change
Expand Up @@ -3272,8 +3272,9 @@ mega_init_scb(adapter_t *adapter)
* @filep - unused
*
* Routines for the character/ioctl interface to the driver. Find out if this
* is a valid open. If yes, increment the module use count so that it cannot
* be unloaded.
* is a valid open.
*
* No BKL needed here.
*/
static int
megadev_open (struct inode *inode, struct file *filep)
Expand Down
1 change: 1 addition & 0 deletions drivers/scsi/megaraid/megaraid_sas.c
Original file line number Diff line number Diff line change
Expand Up @@ -2860,6 +2860,7 @@ static void megasas_shutdown(struct pci_dev *pdev)

/**
* megasas_mgmt_open - char node "open" entry point
* No BKL is needed here.
*/
static int megasas_mgmt_open(struct inode *inode, struct file *filep)
{
Expand Down

0 comments on commit d21c95c

Please sign in to comment.