sr.c (c87866ede44ad7da6b296d732221dc34ce1b154d) | sr.c (9c2b9dbafc067e173db30c4fd0636392d27944e8) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * sr.c Copyright (C) 1992 David Giller 4 * Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale 5 * 6 * adapted from: 7 * sd.c Copyright (C) 1992 Drew Eckhardt 8 * Linux scsi disk driver by --- 92 unchanged lines hidden (view full) --- 101 }, 102 .init_command = sr_init_command, 103 .done = sr_done, 104}; 105 106static unsigned long sr_index_bits[SR_DISKS / BITS_PER_LONG]; 107static DEFINE_SPINLOCK(sr_index_lock); 108 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * sr.c Copyright (C) 1992 David Giller 4 * Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale 5 * 6 * adapted from: 7 * sd.c Copyright (C) 1992 Drew Eckhardt 8 * Linux scsi disk driver by --- 92 unchanged lines hidden (view full) --- 101 }, 102 .init_command = sr_init_command, 103 .done = sr_done, 104}; 105 106static unsigned long sr_index_bits[SR_DISKS / BITS_PER_LONG]; 107static DEFINE_SPINLOCK(sr_index_lock); 108 |
109static struct lock_class_key sr_bio_compl_lkclass; 110 |
|
109/* This semaphore is used to mediate the 0->1 reference get in the 110 * face of object destruction (i.e. we can't allow a get on an 111 * object after last put) */ 112static DEFINE_MUTEX(sr_ref_mutex); 113 114static int sr_open(struct cdrom_device_info *, int); 115static void sr_release(struct cdrom_device_info *); 116 --- 99 unchanged lines hidden (view full) --- 216 if (eh->nea || eh->notification_class != 0x4) 217 return 0; 218 219 if (med->media_event_code == 1) 220 return DISK_EVENT_EJECT_REQUEST; 221 else if (med->media_event_code == 2) 222 return DISK_EVENT_MEDIA_CHANGE; 223 else if (med->media_event_code == 3) | 111/* This semaphore is used to mediate the 0->1 reference get in the 112 * face of object destruction (i.e. we can't allow a get on an 113 * object after last put) */ 114static DEFINE_MUTEX(sr_ref_mutex); 115 116static int sr_open(struct cdrom_device_info *, int); 117static void sr_release(struct cdrom_device_info *); 118 --- 99 unchanged lines hidden (view full) --- 218 if (eh->nea || eh->notification_class != 0x4) 219 return 0; 220 221 if (med->media_event_code == 1) 222 return DISK_EVENT_EJECT_REQUEST; 223 else if (med->media_event_code == 2) 224 return DISK_EVENT_MEDIA_CHANGE; 225 else if (med->media_event_code == 3) |
224 return DISK_EVENT_MEDIA_CHANGE; | 226 return DISK_EVENT_EJECT_REQUEST; |
225 return 0; 226} 227 228/* 229 * This function checks to see if the media has been changed or eject 230 * button has been pressed. It is possible that we have already 231 * sensed a change, or the drive may have sensed one and not yet 232 * reported it. The past events are accumulated in sdev->changed and --- 474 unchanged lines hidden (view full) --- 707 708 error = -ENOMEM; 709 cd = kzalloc(sizeof(*cd), GFP_KERNEL); 710 if (!cd) 711 goto fail; 712 713 kref_init(&cd->kref); 714 | 227 return 0; 228} 229 230/* 231 * This function checks to see if the media has been changed or eject 232 * button has been pressed. It is possible that we have already 233 * sensed a change, or the drive may have sensed one and not yet 234 * reported it. The past events are accumulated in sdev->changed and --- 474 unchanged lines hidden (view full) --- 709 710 error = -ENOMEM; 711 cd = kzalloc(sizeof(*cd), GFP_KERNEL); 712 if (!cd) 713 goto fail; 714 715 kref_init(&cd->kref); 716 |
715 disk = alloc_disk(1); | 717 disk = __alloc_disk_node(1, NUMA_NO_NODE, &sr_bio_compl_lkclass); |
716 if (!disk) 717 goto fail_free; 718 mutex_init(&cd->lock); 719 720 spin_lock(&sr_index_lock); 721 minor = find_first_zero_bit(sr_index_bits, SR_DISKS); 722 if (minor == SR_DISKS) { 723 spin_unlock(&sr_index_lock); --- 352 unchanged lines hidden --- | 718 if (!disk) 719 goto fail_free; 720 mutex_init(&cd->lock); 721 722 spin_lock(&sr_index_lock); 723 minor = find_first_zero_bit(sr_index_bits, SR_DISKS); 724 if (minor == SR_DISKS) { 725 spin_unlock(&sr_index_lock); --- 352 unchanged lines hidden --- |