From 8ee913ba680dc520abcf08140436029e0e493220 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Fri, 18 May 2018 14:26:35 +0200 Subject: Allocate dma buffer for surface --- char.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'char.c') diff --git a/char.c b/char.c index 881c3d0..a4ba095 100644 --- a/char.c +++ b/char.c @@ -19,8 +19,9 @@ int next_minor = 0; long doom_create_surface(struct file *filp, unsigned long arg) { struct doomdev_ioctl_create_surface *params; + params = (struct doomdev_ioctl_create_surface *)arg; - return new_surface(params); + return new_surface(filp, params); } long doom_create_texture(struct file *filp, unsigned long arg) @@ -81,33 +82,27 @@ int new_doomdev(struct pci_dev *dev) doom_data = pci_get_drvdata(dev); - doom_data->cdev = cdev_alloc(); - if (doom_data->cdev == NULL) { - err = -ENOMEM; - goto error_cdev; - } - cdev_init(doom_data->cdev, &doomdev_fops); - ORFAIL(cdev_add(doom_data->cdev, first, 1), error_add); + cdev_init(&doom_data->cdev, &doomdev_fops); + ORFAIL(cdev_add(&doom_data->cdev, first, 1), error_add); minor = next_minor++; devt = MKDEV(major, minor); doom_data->device = device_create(doom_class, &dev->dev, devt, NULL, - "doom%d", minor), + "doom%d", minor); ORFAIL_PTR(doom_data->device, error_create); return 0; error_create: - cdev_del(doom_data->cdev); + cdev_del(&doom_data->cdev); error_add: -error_cdev: return err; } void destroy_doomdev(struct doom_data *doom_data) { device_destroy(doom_class, doom_data->device->devt); - cdev_del(doom_data->cdev); + cdev_del(&doom_data->cdev); } int char_init(void) -- cgit v1.2.3