Skip to content

Commit ac751ef

Browse files
torbenh3torvalds
authored andcommitted
console: rename acquire/release_console_sem() to console_lock/unlock()
The -rt patches change the console_semaphore to console_mutex. As a result, a quite large chunk of the patches changes all acquire/release_console_sem() to acquire/release_console_mutex() This commit makes things use more neutral function names which dont make implications about the underlying lock. The only real change is the return value of console_trylock which is inverted from try_acquire_console_sem() This patch also paves the way to switching console_sem from a semaphore to a mutex. [[email protected]: coding-style fixes] [[email protected]: make console_trylock return 1 on success, per Geert] Signed-off-by: Torben Hohn <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Greg KH <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 3689456 commit ac751ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+336
-328
lines changed

arch/arm/mach-omap2/pm24xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static void omap2_enter_full_retention(void)
134134

135135
/* Block console output in case it is on one of the OMAP UARTs */
136136
if (!is_suspending())
137-
if (try_acquire_console_sem())
137+
if (!console_trylock())
138138
goto no_sleep;
139139

140140
omap_uart_prepare_idle(0);
@@ -151,7 +151,7 @@ static void omap2_enter_full_retention(void)
151151
omap_uart_resume_idle(0);
152152

153153
if (!is_suspending())
154-
release_console_sem();
154+
console_unlock();
155155

156156
no_sleep:
157157
if (omap2_pm_debug) {

arch/arm/mach-omap2/pm34xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ void omap_sram_idle(void)
398398
if (!is_suspending())
399399
if (per_next_state < PWRDM_POWER_ON ||
400400
core_next_state < PWRDM_POWER_ON)
401-
if (try_acquire_console_sem())
401+
if (!console_trylock())
402402
goto console_still_active;
403403

404404
/* PER */
@@ -481,7 +481,7 @@ void omap_sram_idle(void)
481481
}
482482

483483
if (!is_suspending())
484-
release_console_sem();
484+
console_unlock();
485485

486486
console_still_active:
487487
/* Disable IO-PAD and IO-CHAIN wakeup */

arch/arm/mach-omap2/serial.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
812812

813813
oh->dev_attr = uart;
814814

815-
acquire_console_sem(); /* in case the earlycon is on the UART */
815+
console_lock(); /* in case the earlycon is on the UART */
816816

817817
/*
818818
* Because of early UART probing, UART did not get idled
@@ -838,7 +838,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
838838
omap_uart_block_sleep(uart);
839839
uart->timeout = DEFAULT_TIMEOUT;
840840

841-
release_console_sem();
841+
console_unlock();
842842

843843
if ((cpu_is_omap34xx() && uart->padconf) ||
844844
(uart->wk_en && uart->wk_mask)) {

arch/parisc/kernel/pdc_cons.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ static int __init pdc_console_tty_driver_init(void)
169169

170170
struct console *tmp;
171171

172-
acquire_console_sem();
172+
console_lock();
173173
for_each_console(tmp)
174174
if (tmp == &pdc_cons)
175175
break;
176-
release_console_sem();
176+
console_unlock();
177177

178178
if (!tmp) {
179179
printk(KERN_INFO "PDC console driver not registered anymore, not creating %s\n", pdc_cons.name);

drivers/char/bfin_jtag_comm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,16 @@ bfin_jc_circ_write(const unsigned char *buf, int count)
183183
}
184184

185185
#ifndef CONFIG_BFIN_JTAG_COMM_CONSOLE
186-
# define acquire_console_sem()
187-
# define release_console_sem()
186+
# define console_lock()
187+
# define console_unlock()
188188
#endif
189189
static int
190190
bfin_jc_write(struct tty_struct *tty, const unsigned char *buf, int count)
191191
{
192192
int i;
193-
acquire_console_sem();
193+
console_lock();
194194
i = bfin_jc_circ_write(buf, count);
195-
release_console_sem();
195+
console_unlock();
196196
wake_up_process(bfin_jc_kthread);
197197
return i;
198198
}

drivers/gpu/drm/nouveau/nouveau_drv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
234234
pci_set_power_state(pdev, PCI_D3hot);
235235
}
236236

237-
acquire_console_sem();
237+
console_lock();
238238
nouveau_fbcon_set_suspend(dev, 1);
239-
release_console_sem();
239+
console_unlock();
240240
nouveau_fbcon_restore_accel(dev);
241241
return 0;
242242

@@ -359,9 +359,9 @@ nouveau_pci_resume(struct pci_dev *pdev)
359359
nv_crtc->lut.depth = 0;
360360
}
361361

362-
acquire_console_sem();
362+
console_lock();
363363
nouveau_fbcon_set_suspend(dev, 0);
364-
release_console_sem();
364+
console_unlock();
365365

366366
nouveau_fbcon_zfill_all(dev);
367367

drivers/gpu/drm/radeon/radeon_device.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -891,9 +891,9 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
891891
pci_disable_device(dev->pdev);
892892
pci_set_power_state(dev->pdev, PCI_D3hot);
893893
}
894-
acquire_console_sem();
894+
console_lock();
895895
radeon_fbdev_set_suspend(rdev, 1);
896-
release_console_sem();
896+
console_unlock();
897897
return 0;
898898
}
899899

@@ -905,11 +905,11 @@ int radeon_resume_kms(struct drm_device *dev)
905905
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
906906
return 0;
907907

908-
acquire_console_sem();
908+
console_lock();
909909
pci_set_power_state(dev->pdev, PCI_D0);
910910
pci_restore_state(dev->pdev);
911911
if (pci_enable_device(dev->pdev)) {
912-
release_console_sem();
912+
console_unlock();
913913
return -1;
914914
}
915915
pci_set_master(dev->pdev);
@@ -920,7 +920,7 @@ int radeon_resume_kms(struct drm_device *dev)
920920
radeon_restore_bios_scratch_regs(rdev);
921921

922922
radeon_fbdev_set_suspend(rdev, 0);
923-
release_console_sem();
923+
console_unlock();
924924

925925
/* reset hpd state */
926926
radeon_hpd_init(rdev);

drivers/staging/msm/msm_fb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static int msm_fb_suspend(struct platform_device *pdev, pm_message_t state)
347347
if ((!mfd) || (mfd->key != MFD_KEY))
348348
return 0;
349349

350-
acquire_console_sem();
350+
console_lock();
351351
fb_set_suspend(mfd->fbi, 1);
352352

353353
ret = msm_fb_suspend_sub(mfd);
@@ -358,7 +358,7 @@ static int msm_fb_suspend(struct platform_device *pdev, pm_message_t state)
358358
pdev->dev.power.power_state = state;
359359
}
360360

361-
release_console_sem();
361+
console_unlock();
362362
return ret;
363363
}
364364
#else
@@ -431,11 +431,11 @@ static int msm_fb_resume(struct platform_device *pdev)
431431
if ((!mfd) || (mfd->key != MFD_KEY))
432432
return 0;
433433

434-
acquire_console_sem();
434+
console_lock();
435435
ret = msm_fb_resume_sub(mfd);
436436
pdev->dev.power.power_state = PMSG_ON;
437437
fb_set_suspend(mfd->fbi, 1);
438-
release_console_sem();
438+
console_unlock();
439439

440440
return ret;
441441
}

drivers/staging/olpc_dcon/olpc_dcon.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,17 +373,17 @@ static void dcon_source_switch(struct work_struct *work)
373373
*
374374
* For now, we just hope..
375375
*/
376-
acquire_console_sem();
376+
console_lock();
377377
ignore_fb_events = 1;
378378
if (fb_blank(fbinfo, FB_BLANK_UNBLANK)) {
379379
ignore_fb_events = 0;
380-
release_console_sem();
380+
console_unlock();
381381
printk(KERN_ERR "olpc-dcon: Failed to enter CPU mode\n");
382382
dcon_pending = DCON_SOURCE_DCON;
383383
return;
384384
}
385385
ignore_fb_events = 0;
386-
release_console_sem();
386+
console_unlock();
387387

388388
/* And turn off the DCON */
389389
pdata->set_dconload(1);
@@ -435,12 +435,12 @@ static void dcon_source_switch(struct work_struct *work)
435435
}
436436
}
437437

438-
acquire_console_sem();
438+
console_lock();
439439
ignore_fb_events = 1;
440440
if (fb_blank(fbinfo, FB_BLANK_POWERDOWN))
441441
printk(KERN_ERR "olpc-dcon: couldn't blank fb!\n");
442442
ignore_fb_events = 0;
443-
release_console_sem();
443+
console_unlock();
444444

445445
printk(KERN_INFO "olpc-dcon: The DCON has control\n");
446446
break;

drivers/staging/sm7xx/smtcfb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,9 +1044,9 @@ static int __maybe_unused smtcfb_suspend(struct pci_dev *pdev, pm_message_t msg)
10441044

10451045
/* when doing suspend, call fb apis and pci apis */
10461046
if (msg.event == PM_EVENT_SUSPEND) {
1047-
acquire_console_sem();
1047+
console_lock();
10481048
fb_set_suspend(&sfb->fb, 1);
1049-
release_console_sem();
1049+
console_unlock();
10501050
retv = pci_save_state(pdev);
10511051
pci_disable_device(pdev);
10521052
retv = pci_choose_state(pdev, msg);
@@ -1105,9 +1105,9 @@ static int __maybe_unused smtcfb_resume(struct pci_dev *pdev)
11051105

11061106
smtcfb_setmode(sfb);
11071107

1108-
acquire_console_sem();
1108+
console_lock();
11091109
fb_set_suspend(&sfb->fb, 0);
1110-
release_console_sem();
1110+
console_unlock();
11111111

11121112
return 0;
11131113
}

drivers/tty/serial/sb1250-duart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ static void __init sbd_probe_duarts(void)
829829
#ifdef CONFIG_SERIAL_SB1250_DUART_CONSOLE
830830
/*
831831
* Serial console stuff. Very basic, polling driver for doing serial
832-
* console output. The console_sem is held by the caller, so we
832+
* console output. The console_lock is held by the caller, so we
833833
* shouldn't be interrupted for more console activity.
834834
*/
835835
static void sbd_console_putchar(struct uart_port *uport, int ch)

drivers/tty/tty_io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3256,7 +3256,7 @@ static ssize_t show_cons_active(struct device *dev,
32563256
struct console *c;
32573257
ssize_t count = 0;
32583258

3259-
acquire_console_sem();
3259+
console_lock();
32603260
for (c = console_drivers; c; c = c->next) {
32613261
if (!c->device)
32623262
continue;
@@ -3271,7 +3271,7 @@ static ssize_t show_cons_active(struct device *dev,
32713271
while (i--)
32723272
count += sprintf(buf + count, "%s%d%c",
32733273
cs[i]->name, cs[i]->index, i ? ' ':'\n');
3274-
release_console_sem();
3274+
console_unlock();
32753275

32763276
return count;
32773277
}

drivers/tty/vt/selection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ int paste_selection(struct tty_struct *tty)
316316
/* always called with BTM from vt_ioctl */
317317
WARN_ON(!tty_locked());
318318

319-
acquire_console_sem();
319+
console_lock();
320320
poke_blanked_console();
321-
release_console_sem();
321+
console_unlock();
322322

323323
ld = tty_ldisc_ref(tty);
324324
if (!ld) {

drivers/tty/vt/vc_screen.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
202202
/* Select the proper current console and verify
203203
* sanity of the situation under the console lock.
204204
*/
205-
acquire_console_sem();
205+
console_lock();
206206

207207
attr = (currcons & 128);
208208
currcons = (currcons & 127);
@@ -336,9 +336,9 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
336336
* the pagefault handling code may want to call printk().
337337
*/
338338

339-
release_console_sem();
339+
console_unlock();
340340
ret = copy_to_user(buf, con_buf_start, orig_count);
341-
acquire_console_sem();
341+
console_lock();
342342

343343
if (ret) {
344344
read += (orig_count - ret);
@@ -354,7 +354,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
354354
if (read)
355355
ret = read;
356356
unlock_out:
357-
release_console_sem();
357+
console_unlock();
358358
mutex_unlock(&con_buf_mtx);
359359
return ret;
360360
}
@@ -379,7 +379,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
379379
/* Select the proper current console and verify
380380
* sanity of the situation under the console lock.
381381
*/
382-
acquire_console_sem();
382+
console_lock();
383383

384384
attr = (currcons & 128);
385385
currcons = (currcons & 127);
@@ -414,9 +414,9 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
414414
/* Temporarily drop the console lock so that we can read
415415
* in the write data from userspace safely.
416416
*/
417-
release_console_sem();
417+
console_unlock();
418418
ret = copy_from_user(con_buf, buf, this_round);
419-
acquire_console_sem();
419+
console_lock();
420420

421421
if (ret) {
422422
this_round -= ret;
@@ -542,7 +542,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
542542
vcs_scr_updated(vc);
543543

544544
unlock_out:
545-
release_console_sem();
545+
console_unlock();
546546

547547
mutex_unlock(&con_buf_mtx);
548548

0 commit comments

Comments
 (0)