class_simple_device_remove(MKDEV(RAW_MAJOR, rq.raw_minor)); 
class_device_destroy(raw_class, MKDEV(RAW_MAJOR, rq.raw_minor)); 
static int raw_ctl_ioctl(struct inode *inode, struct file *filp,			unsigned int command, unsigned long arg){	struct raw_config_request rq;	struct raw_device_data *rawdev;	int err = 0;	switch (command) {	case RAW_SETBIND:	case RAW_GETBIND:		/* First, find out which raw minor we want */		if (copy_from_user(&rq, (void __user *) arg, sizeof(rq))) {			err = -EFAULT;			goto out;		}		if (rq.raw_minor < 0 || rq.raw_minor >= MAX_RAW_MINORS) {			err = -EINVAL;			goto out;		}		rawdev = &raw_devices[rq.raw_minor];		if (command == RAW_SETBIND) {			dev_t dev;			/*			 * This is like making block devices, so demand the			 * same capability			 */			if (!capable(CAP_SYS_ADMIN)) {				err = -EPERM;				goto out;			}			/*			 * For now, we don't need to check that the underlying			 * block device is present or not: we can do that when			 * the raw device is opened.  Just check that the			 * major/minor numbers make sense.			 */			dev = MKDEV(rq.block_major, rq.block_minor);			if ((rq.block_major == 0 && rq.block_minor != 0) ||					MAJOR(dev) != rq.block_major ||					MINOR(dev) != rq.block_minor) {				err = -EINVAL;				goto out;			}			down(&raw_mutex);			if (rawdev->inuse) {				up(&raw_mutex);				err = -EBUSY;				goto out;			}			if (rawdev->binding) {				bdput(rawdev->binding);				module_put(THIS_MODULE);			}			if (rq.block_major == 0 && rq.block_minor == 0) {				/* unbind */				rawdev->binding = NULL;				class_simple_device_remove(MKDEV(RAW_MAJOR,								rq.raw_minor));			} else {				rawdev->binding = bdget(dev);				if (rawdev->binding == NULL)					err = -ENOMEM;				else {					__module_get(THIS_MODULE);					bind_device(&rq);				}			}			up(&raw_mutex);		} else {			struct block_device *bdev;			down(&raw_mutex);			bdev = rawdev->binding;			if (bdev) {				rq.block_major = MAJOR(bdev->bd_dev);				rq.block_minor = MINOR(bdev->bd_dev);			} else {				rq.block_major = rq.block_minor = 0;			}			up(&raw_mutex);			if (copy_to_user((void __user *)arg, &rq, sizeof(rq))) {				err = -EFAULT;				goto out;			}		}		break;	default:		err = -EINVAL;		break;	}out:	return err;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/ca8eca6884861c1ce294b05aacfdf9045bba9aff/raw.c/buggy/drivers/char/raw.c