Skip to content

Commit

Permalink
Merge branches 'irq-core-for-linus' and 'core-locking-for-linus' of g…
Browse files Browse the repository at this point in the history
…it://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  genirq: Fix up irq_node() for irq_data changes.
  genirq: Add single IRQ reservation helper
  genirq: Warn if enable_irq is called before irq is set up

* 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  semaphore: Remove mutex emulation
  staging: Final semaphore cleanup
  jbd2: Convert jbd2_slab_create_sem to mutex
  hpfs: Convert sbi->hpfs_creation_de to mutex

Fix up trivial change/delete conflicts with deleted 'dream' drivers
(drivers/staging/dream/camera/{mt9d112.c,mt9p012_fox.c,mt9t013.c,s5k3e2fx.c})
  • Loading branch information
torvalds committed Nov 1, 2010
3 parents bb8430a + 4600d7c + 4882720 commit 82279e6
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 37 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/ath6kl/os/linux/ar6000_raw_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ int ar6000_htc_raw_open(AR_SOFTC_T *ar)

for (streamID = HTC_RAW_STREAM_0; streamID < HTC_RAW_STREAM_NUM_MAX; streamID++) {
/* Initialize the data structures */
init_MUTEX(&arRaw->raw_htc_read_sem[streamID]);
init_MUTEX(&arRaw->raw_htc_write_sem[streamID]);
sema_init(&arRaw->raw_htc_read_sem[streamID], 1);
sema_init(&arRaw->raw_htc_write_sem[streamID], 1);
init_waitqueue_head(&arRaw->raw_htc_read_queue[streamID]);
init_waitqueue_head(&arRaw->raw_htc_write_queue[streamID]);

Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/brcm80211/brcmfmac/dhd_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@ dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
goto fail;

net->netdev_ops = NULL;
init_MUTEX(&dhd->proto_sem);
sema_init(&dhd->proto_sem, 1);
/* Initialize other structure content */
init_waitqueue_head(&dhd->ioctl_resp_wait);
init_waitqueue_head(&dhd->ctrl_wait);
Expand Down Expand Up @@ -1977,7 +1977,7 @@ dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
dhd->timer.function = dhd_watchdog;

/* Initialize thread based operation and lock */
init_MUTEX(&dhd->sdsem);
sema_init(&dhd->sdsem, 1);
if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0))
dhd->threads_only = true;
else
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/sys/wl_mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ static wl_info_t *wl_attach(u16 vendor, u16 device, unsigned long regs,
spin_lock_init(&wl->rpcq_lock);
spin_lock_init(&wl->txq_lock);

init_MUTEX(&wl->sem);
sema_init(&wl->sem, 1);
#else
spin_lock_init(&wl->lock);
spin_lock_init(&wl->isr_lock);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers/dt9812.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ struct dt9812_usb_cmd {

#define DT9812_NUM_SLOTS 16

static DECLARE_MUTEX(dt9812_mutex);
static DEFINE_SEMAPHORE(dt9812_mutex);

static const struct usb_device_id dt9812_table[] = {
{USB_DEVICE(0x0867, 0x9812)},
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/comedi/drivers/usbdux.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ struct usbduxsub {
*/
static struct usbduxsub usbduxsub[NUMUSBDUX];

static DECLARE_MUTEX(start_stop_sem);
static DEFINE_SEMAPHORE(start_stop_sem);

/*
* Stops the data acquision
Expand Down Expand Up @@ -2367,7 +2367,7 @@ static int usbduxsub_probe(struct usb_interface *uinterf,
dev_dbg(dev, "comedi_: usbdux: "
"usbduxsub[%d] is ready to connect to comedi.\n", index);

init_MUTEX(&(usbduxsub[index].sem));
sema_init(&(usbduxsub[index].sem), 1);
/* save a pointer to the usb device */
usbduxsub[index].usbdev = udev;

Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/comedi/drivers/usbduxfast.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ struct usbduxfastsub_s {
*/
static struct usbduxfastsub_s usbduxfastsub[NUMUSBDUXFAST];

static DECLARE_MUTEX(start_stop_sem);
static DEFINE_SEMAPHORE(start_stop_sem);

/*
* bulk transfers to usbduxfast
Expand Down Expand Up @@ -1504,7 +1504,7 @@ static int usbduxfastsub_probe(struct usb_interface *uinterf,
"connect to comedi.\n", index);
#endif

init_MUTEX(&(usbduxfastsub[index].sem));
sema_init(&(usbduxfastsub[index].sem), 1);
/* save a pointer to the usb device */
usbduxfastsub[index].usbdev = udev;

Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/msm/msm_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ static int msm_fb_release(struct fb_info *info, int user)
return ret;
}

DECLARE_MUTEX(msm_fb_pan_sem);
DEFINE_SEMAPHORE(msm_fb_pan_sem);

static int msm_fb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info)
Expand Down Expand Up @@ -1962,7 +1962,7 @@ static int msmfb_overlay_play(struct fb_info *info, unsigned long *argp)

#endif

DECLARE_MUTEX(msm_fb_ioctl_ppp_sem);
DEFINE_SEMAPHORE(msm_fb_ioctl_ppp_sem);
DEFINE_MUTEX(msm_fb_ioctl_lut_sem);
DEFINE_MUTEX(msm_fb_ioctl_hist_sem);

Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8712/osdep_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static inline u32 _down_sema(struct semaphore *sema)

static inline void _rtl_rwlock_init(struct semaphore *prwlock)
{
init_MUTEX(prwlock);
sema_init(prwlock, 1);
}

static inline void _init_listhead(struct list_head *list)
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/smbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
server->mnt = NULL;
server->sock_file = NULL;
init_waitqueue_head(&server->conn_wq);
init_MUTEX(&server->sem);
sema_init(&server->sem, 1);
INIT_LIST_HEAD(&server->entry);
INIT_LIST_HEAD(&server->xmitq);
INIT_LIST_HEAD(&server->recvq);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ struct cyasblkdev_blk_data {
/* pointer to west bridge block data device superstructure */
static struct cyasblkdev_blk_data *gl_bd;

static DECLARE_MUTEX(open_lock);
static DEFINE_SEMAPHORE(open_lock);

/* local forwardd declarationss */
static cy_as_device_handle *cyas_dev_handle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ int cyasblkdev_init_queue(struct cyasblkdev_queue *bq, spinlock_t *lock)

init_completion(&bq->thread_complete);
init_waitqueue_head(&bq->thread_wq);
init_MUTEX(&bq->thread_sem);
sema_init(&bq->thread_sem, 1);

ret = kernel_thread(cyasblkdev_queue_thread, bq, CLONE_KERNEL);
if (ret >= 0) {
Expand Down
4 changes: 2 additions & 2 deletions fs/hpfs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ void hpfs_lock_creation(struct super_block *s)
#ifdef DEBUG_LOCKS
printk("lock creation\n");
#endif
down(&hpfs_sb(s)->hpfs_creation_de);
mutex_lock(&hpfs_sb(s)->hpfs_creation_de);
}

void hpfs_unlock_creation(struct super_block *s)
{
#ifdef DEBUG_LOCKS
printk("unlock creation\n");
#endif
up(&hpfs_sb(s)->hpfs_creation_de);
mutex_unlock(&hpfs_sb(s)->hpfs_creation_de);
}

/* Map a sector into a buffer and return pointers to it and to the buffer. */
Expand Down
2 changes: 1 addition & 1 deletion fs/hpfs/hpfs_fn.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct hpfs_sb_info {
unsigned *sb_bmp_dir; /* main bitmap directory */
unsigned sb_c_bitmap; /* current bitmap */
unsigned sb_max_fwd_alloc; /* max forwad allocation */
struct semaphore hpfs_creation_de; /* when creating dirents, nobody else
struct mutex hpfs_creation_de; /* when creating dirents, nobody else
can alloc blocks */
/*unsigned sb_mounting : 1;*/
int sb_timeshift;
Expand Down
2 changes: 1 addition & 1 deletion fs/hpfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
sbi->sb_bmp_dir = NULL;
sbi->sb_cp_table = NULL;

init_MUTEX(&sbi->hpfs_creation_de);
mutex_init(&sbi->hpfs_creation_de);

uid = current_uid();
gid = current_gid();
Expand Down
8 changes: 4 additions & 4 deletions fs/jbd2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,6 @@ size_t journal_tag_bytes(journal_t *journal)
*/
#define JBD2_MAX_SLABS 8
static struct kmem_cache *jbd2_slab[JBD2_MAX_SLABS];
static DECLARE_MUTEX(jbd2_slab_create_sem);

static const char *jbd2_slab_names[JBD2_MAX_SLABS] = {
"jbd2_1k", "jbd2_2k", "jbd2_4k", "jbd2_8k",
Expand All @@ -1859,6 +1858,7 @@ static void jbd2_journal_destroy_slabs(void)

static int jbd2_journal_create_slab(size_t size)
{
static DEFINE_MUTEX(jbd2_slab_create_mutex);
int i = order_base_2(size) - 10;
size_t slab_size;

Expand All @@ -1870,16 +1870,16 @@ static int jbd2_journal_create_slab(size_t size)

if (unlikely(i < 0))
i = 0;
down(&jbd2_slab_create_sem);
mutex_lock(&jbd2_slab_create_mutex);
if (jbd2_slab[i]) {
up(&jbd2_slab_create_sem);
mutex_unlock(&jbd2_slab_create_mutex);
return 0; /* Already created */
}

slab_size = 1 << (i+10);
jbd2_slab[i] = kmem_cache_create(jbd2_slab_names[i], slab_size,
slab_size, 0, NULL);
up(&jbd2_slab_create_sem);
mutex_unlock(&jbd2_slab_create_mutex);
if (!jbd2_slab[i]) {
printk(KERN_EMERG "JBD2: no memory for jbd2_slab cache\n");
return -ENOMEM;
Expand Down
5 changes: 5 additions & 0 deletions include/linux/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ static inline void irq_free_desc(unsigned int irq)
irq_free_descs(irq, 1);
}

static inline int irq_reserve_irq(unsigned int irq)
{
return irq_reserve_irqs(irq, 1);
}

#endif /* CONFIG_GENERIC_HARDIRQS */

#endif /* !CONFIG_S390 */
Expand Down
2 changes: 1 addition & 1 deletion include/linux/irqnr.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ unsigned int irq_get_next_irq(unsigned int offset);
else

#ifdef CONFIG_SMP
#define irq_node(irq) (irq_to_desc(irq)->node)
#define irq_node(irq) (irq_get_irq_data(irq)->node)
#else
#define irq_node(irq) 0
#endif
Expand Down
6 changes: 0 additions & 6 deletions include/linux/semaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,13 @@ struct semaphore {
#define DEFINE_SEMAPHORE(name) \
struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)

#define DECLARE_MUTEX(name) \
struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)

static inline void sema_init(struct semaphore *sem, int val)
{
static struct lock_class_key __key;
*sem = (struct semaphore) __SEMAPHORE_INITIALIZER(*sem, val);
lockdep_init_map(&sem->lock.dep_map, "semaphore->lock", &__key, 0);
}

#define init_MUTEX(sem) sema_init(sem, 1)
#define init_MUTEX_LOCKED(sem) sema_init(sem, 0)

extern void down(struct semaphore *sem);
extern int __must_check down_interruptible(struct semaphore *sem);
extern int __must_check down_killable(struct semaphore *sem);
Expand Down
4 changes: 4 additions & 0 deletions kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ void enable_irq(unsigned int irq)
if (!desc)
return;

if (WARN(!desc->irq_data.chip || !desc->irq_data.chip->irq_enable,
KERN_ERR "enable_irq before setup/request_irq: irq %u\n", irq))
return;

chip_bus_lock(desc);
raw_spin_lock_irqsave(&desc->lock, flags);
__enable_irq(desc, irq, false);
Expand Down
8 changes: 2 additions & 6 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2794,12 +2794,8 @@ sub process {
WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
}

# check for semaphores used as mutexes
if ($line =~ /^.\s*(DECLARE_MUTEX|init_MUTEX)\s*\(/) {
WARN("mutexes are preferred for single holder semaphores\n" . $herecurr);
}
# check for semaphores used as mutexes
if ($line =~ /^.\s*init_MUTEX_LOCKED\s*\(/) {
# check for semaphores initialized locked
if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
WARN("consider using a completion\n" . $herecurr);

}
Expand Down

0 comments on commit 82279e6

Please sign in to comment.