diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cdrom/cdrom.c | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 79245714f0a7..d70745c84250 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -3458,47 +3458,19 @@ static void cdrom_update_settings(void) | |||
3458 | static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp, | 3458 | static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp, |
3459 | void __user *buffer, size_t *lenp, loff_t *ppos) | 3459 | void __user *buffer, size_t *lenp, loff_t *ppos) |
3460 | { | 3460 | { |
3461 | int *valp = ctl->data; | ||
3462 | int val = *valp; | ||
3463 | int ret; | 3461 | int ret; |
3464 | 3462 | ||
3465 | ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); | 3463 | ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); |
3466 | 3464 | ||
3467 | if (write && *valp != val) { | 3465 | if (write) { |
3468 | 3466 | ||
3469 | /* we only care for 1 or 0. */ | 3467 | /* we only care for 1 or 0. */ |
3470 | if (*valp) | 3468 | autoclose = !!cdrom_sysctl_settings.autoclose; |
3471 | *valp = 1; | 3469 | autoeject = !!cdrom_sysctl_settings.autoeject; |
3472 | else | 3470 | debug = !!cdrom_sysctl_settings.debug; |
3473 | *valp = 0; | 3471 | lockdoor = !!cdrom_sysctl_settings.lock; |
3472 | check_media_type = !!cdrom_sysctl_settings.check; | ||
3474 | 3473 | ||
3475 | switch (ctl->ctl_name) { | ||
3476 | case DEV_CDROM_AUTOCLOSE: { | ||
3477 | if (valp == &cdrom_sysctl_settings.autoclose) | ||
3478 | autoclose = cdrom_sysctl_settings.autoclose; | ||
3479 | break; | ||
3480 | } | ||
3481 | case DEV_CDROM_AUTOEJECT: { | ||
3482 | if (valp == &cdrom_sysctl_settings.autoeject) | ||
3483 | autoeject = cdrom_sysctl_settings.autoeject; | ||
3484 | break; | ||
3485 | } | ||
3486 | case DEV_CDROM_DEBUG: { | ||
3487 | if (valp == &cdrom_sysctl_settings.debug) | ||
3488 | debug = cdrom_sysctl_settings.debug; | ||
3489 | break; | ||
3490 | } | ||
3491 | case DEV_CDROM_LOCK: { | ||
3492 | if (valp == &cdrom_sysctl_settings.lock) | ||
3493 | lockdoor = cdrom_sysctl_settings.lock; | ||
3494 | break; | ||
3495 | } | ||
3496 | case DEV_CDROM_CHECK_MEDIA: { | ||
3497 | if (valp == &cdrom_sysctl_settings.check) | ||
3498 | check_media_type = cdrom_sysctl_settings.check; | ||
3499 | break; | ||
3500 | } | ||
3501 | } | ||
3502 | /* update the option flags according to the changes. we | 3474 | /* update the option flags according to the changes. we |
3503 | don't have per device options through sysctl yet, | 3475 | don't have per device options through sysctl yet, |
3504 | but we will have and then this will disappear. */ | 3476 | but we will have and then this will disappear. */ |
@@ -3511,7 +3483,6 @@ static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp, | |||
3511 | /* Place files in /proc/sys/dev/cdrom */ | 3483 | /* Place files in /proc/sys/dev/cdrom */ |
3512 | static ctl_table cdrom_table[] = { | 3484 | static ctl_table cdrom_table[] = { |
3513 | { | 3485 | { |
3514 | .ctl_name = DEV_CDROM_INFO, | ||
3515 | .procname = "info", | 3486 | .procname = "info", |
3516 | .data = &cdrom_sysctl_settings.info, | 3487 | .data = &cdrom_sysctl_settings.info, |
3517 | .maxlen = CDROM_STR_SIZE, | 3488 | .maxlen = CDROM_STR_SIZE, |
@@ -3519,7 +3490,6 @@ static ctl_table cdrom_table[] = { | |||
3519 | .proc_handler = &cdrom_sysctl_info, | 3490 | .proc_handler = &cdrom_sysctl_info, |
3520 | }, | 3491 | }, |
3521 | { | 3492 | { |
3522 | .ctl_name = DEV_CDROM_AUTOCLOSE, | ||
3523 | .procname = "autoclose", | 3493 | .procname = "autoclose", |
3524 | .data = &cdrom_sysctl_settings.autoclose, | 3494 | .data = &cdrom_sysctl_settings.autoclose, |
3525 | .maxlen = sizeof(int), | 3495 | .maxlen = sizeof(int), |
@@ -3527,7 +3497,6 @@ static ctl_table cdrom_table[] = { | |||
3527 | .proc_handler = &cdrom_sysctl_handler, | 3497 | .proc_handler = &cdrom_sysctl_handler, |
3528 | }, | 3498 | }, |
3529 | { | 3499 | { |
3530 | .ctl_name = DEV_CDROM_AUTOEJECT, | ||
3531 | .procname = "autoeject", | 3500 | .procname = "autoeject", |
3532 | .data = &cdrom_sysctl_settings.autoeject, | 3501 | .data = &cdrom_sysctl_settings.autoeject, |
3533 | .maxlen = sizeof(int), | 3502 | .maxlen = sizeof(int), |
@@ -3535,7 +3504,6 @@ static ctl_table cdrom_table[] = { | |||
3535 | .proc_handler = &cdrom_sysctl_handler, | 3504 | .proc_handler = &cdrom_sysctl_handler, |
3536 | }, | 3505 | }, |
3537 | { | 3506 | { |
3538 | .ctl_name = DEV_CDROM_DEBUG, | ||
3539 | .procname = "debug", | 3507 | .procname = "debug", |
3540 | .data = &cdrom_sysctl_settings.debug, | 3508 | .data = &cdrom_sysctl_settings.debug, |
3541 | .maxlen = sizeof(int), | 3509 | .maxlen = sizeof(int), |
@@ -3543,7 +3511,6 @@ static ctl_table cdrom_table[] = { | |||
3543 | .proc_handler = &cdrom_sysctl_handler, | 3511 | .proc_handler = &cdrom_sysctl_handler, |
3544 | }, | 3512 | }, |
3545 | { | 3513 | { |
3546 | .ctl_name = DEV_CDROM_LOCK, | ||
3547 | .procname = "lock", | 3514 | .procname = "lock", |
3548 | .data = &cdrom_sysctl_settings.lock, | 3515 | .data = &cdrom_sysctl_settings.lock, |
3549 | .maxlen = sizeof(int), | 3516 | .maxlen = sizeof(int), |
@@ -3551,7 +3518,6 @@ static ctl_table cdrom_table[] = { | |||
3551 | .proc_handler = &cdrom_sysctl_handler, | 3518 | .proc_handler = &cdrom_sysctl_handler, |
3552 | }, | 3519 | }, |
3553 | { | 3520 | { |
3554 | .ctl_name = DEV_CDROM_CHECK_MEDIA, | ||
3555 | .procname = "check_media", | 3521 | .procname = "check_media", |
3556 | .data = &cdrom_sysctl_settings.check, | 3522 | .data = &cdrom_sysctl_settings.check, |
3557 | .maxlen = sizeof(int), | 3523 | .maxlen = sizeof(int), |