Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 210889 | Differences between
and this patch

Collapse All | Expand All

(-)orig/asus_oled-0.03/asus_oled (-23 / +23 lines)
Lines 116-122 Link Here
116
	size_t			buf_size;
116
	size_t			buf_size;
117
	char			*buf;
117
	char			*buf;
118
	uint8_t			enabled;
118
	uint8_t			enabled;
119
	struct class_device	*class_dev;
119
	struct device		*dev;
120
};
120
};
121
121
122
static void enable_oled(struct asus_oled_dev *odev, uint8_t enabl)
122
static void enable_oled(struct asus_oled_dev *odev, uint8_t enabl)
Lines 166-174 Link Here
166
	return count;
166
	return count;
167
}
167
}
168
168
169
static ssize_t class_set_enabled(struct class_device *class_device, const char *buf, size_t count)
169
static ssize_t class_set_enabled(struct device *device, struct device_attribute *attr, const char *buf, size_t count)
170
{
170
{
171
	struct asus_oled_dev *odev = (struct asus_oled_dev *) class_get_devdata(class_device);
171
	struct asus_oled_dev *odev = (struct asus_oled_dev *) dev_get_drvdata(device);
172
172
173
	int temp = simple_strtoul(buf, NULL, 10);
173
	int temp = simple_strtoul(buf, NULL, 10);
174
174
Lines 185-193 Link Here
185
	return sprintf(buf, "%d\n", odev->enabled);
185
	return sprintf(buf, "%d\n", odev->enabled);
186
}
186
}
187
187
188
static ssize_t class_get_enabled(struct class_device *class_device, char *buf)
188
static ssize_t class_get_enabled(struct device *device, struct device_attribute *attr, char *buf)
189
{
189
{
190
	struct asus_oled_dev *odev = (struct asus_oled_dev *) class_get_devdata(class_device);
190
	struct asus_oled_dev *odev = (struct asus_oled_dev *) dev_get_drvdata(device);
191
191
192
	return sprintf(buf, "%d\n", odev->enabled);
192
	return sprintf(buf, "%d\n", odev->enabled);
193
}
193
}
Lines 426-434 Link Here
426
	return odev_set_picture(usb_get_intfdata(intf), buf, count);
426
	return odev_set_picture(usb_get_intfdata(intf), buf, count);
427
}
427
}
428
428
429
static ssize_t class_set_picture(struct class_device *class_device, const char *buf, size_t count)
429
static ssize_t class_set_picture(struct device *device, struct device_attribute *attr, const char *buf, size_t count)
430
{
430
{
431
	return odev_set_picture((struct asus_oled_dev *) class_get_devdata(class_device), buf, count);
431
	return odev_set_picture((struct asus_oled_dev *) dev_get_drvdata(device), buf, count);
432
}
432
}
433
433
434
#define ASUS_OLED_DEVICE_ATTR(_file)		dev_attr_asus_oled_##_file
434
#define ASUS_OLED_DEVICE_ATTR(_file)		dev_attr_asus_oled_##_file
Lines 436-443 Link Here
436
static DEVICE_ATTR(asus_oled_enabled, S_IWUGO | S_IRUGO, get_enabled, set_enabled);
436
static DEVICE_ATTR(asus_oled_enabled, S_IWUGO | S_IRUGO, get_enabled, set_enabled);
437
static DEVICE_ATTR(asus_oled_picture, S_IWUGO , NULL, set_picture);
437
static DEVICE_ATTR(asus_oled_picture, S_IWUGO , NULL, set_picture);
438
438
439
static CLASS_DEVICE_ATTR (enabled, S_IWUGO | S_IRUGO, class_get_enabled, class_set_enabled);
439
static DEVICE_ATTR(enabled, S_IWUGO | S_IRUGO, class_get_enabled, class_set_enabled);
440
static CLASS_DEVICE_ATTR (picture, S_IWUGO, NULL, class_set_picture);
440
static DEVICE_ATTR(picture, S_IWUGO, NULL, class_set_picture);
441
441
442
static int asus_oled_probe(struct usb_interface *interface, const struct usb_device_id *id)
442
static int asus_oled_probe(struct usb_interface *interface, const struct usb_device_id *id)
443
{
443
{
Lines 463-469 Link Here
463
	odev->last_val = 0;
463
	odev->last_val = 0;
464
	odev->buf = NULL;
464
	odev->buf = NULL;
465
	odev->enabled = 1;
465
	odev->enabled = 1;
466
	odev->class_dev = 0;
466
	odev->dev = 0;
467
467
468
	usb_set_intfdata (interface, odev);
468
	usb_set_intfdata (interface, odev);
469
469
Lines 475-495 Link Here
475
		goto err_files;
475
		goto err_files;
476
	}
476
	}
477
477
478
	odev->class_dev = class_device_create(oled_class, NULL, MKDEV(0,0),
478
	odev->dev = device_create_drvdata(oled_class, &interface->dev, MKDEV(0,0),
479
				&interface->dev, "oled_%d", ++oled_num);
479
				NULL,"oled_%d", ++oled_num);
480
480
481
	if (IS_ERR(odev->class_dev)) {
481
	if (IS_ERR(odev->dev)) {
482
		retval = PTR_ERR(odev->class_dev);
482
		retval = PTR_ERR(odev->dev);
483
		goto err_files;
483
		goto err_files;
484
	}
484
	}
485
485
486
	class_set_devdata(odev->class_dev, odev);
486
	dev_set_drvdata(odev->dev, odev);
487
487
488
	if ( (retval = class_device_create_file(odev->class_dev, &class_device_attr_enabled))) {
488
	if ( (retval = device_create_file(odev->dev, &dev_attr_enabled))) {
489
		goto err_class_enabled;
489
		goto err_class_enabled;
490
	}
490
	}
491
491
492
	if ( (retval = class_device_create_file(odev->class_dev, &class_device_attr_picture))) {
492
	if ( (retval = device_create_file(odev->dev, &dev_attr_picture))) {
493
		goto err_class_picture;
493
		goto err_class_picture;
494
	}
494
	}
495
495
Lines 501-511 Link Here
501
	return 0;
501
	return 0;
502
502
503
err_class_picture:
503
err_class_picture:
504
	class_device_remove_file(odev->class_dev, &class_device_attr_picture);
504
	device_remove_file(odev->dev, &dev_attr_picture);
505
505
506
err_class_enabled:
506
err_class_enabled:
507
	class_device_remove_file(odev->class_dev, &class_device_attr_enabled);
507
	device_remove_file(odev->dev, &dev_attr_enabled);
508
	class_device_unregister(odev->class_dev);
508
	device_unregister(odev->dev);
509
509
510
err_files:
510
err_files:
511
	device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(enabled));
511
	device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(enabled));
Lines 525-533 Link Here
525
	odev = usb_get_intfdata (interface);
525
	odev = usb_get_intfdata (interface);
526
	usb_set_intfdata (interface, NULL);
526
	usb_set_intfdata (interface, NULL);
527
527
528
	class_device_remove_file(odev->class_dev, &class_device_attr_picture);
528
	device_remove_file(odev->dev, &dev_attr_picture);
529
	class_device_remove_file(odev->class_dev, &class_device_attr_enabled);
529
	device_remove_file(odev->dev, &dev_attr_enabled);
530
	class_device_unregister(odev->class_dev);
530
	device_unregister(odev->dev);
531
531
532
	device_remove_file(&interface->dev, & ASUS_OLED_DEVICE_ATTR(picture));
532
	device_remove_file(&interface->dev, & ASUS_OLED_DEVICE_ATTR(picture));
533
	device_remove_file(&interface->dev, & ASUS_OLED_DEVICE_ATTR(enabled));
533
	device_remove_file(&interface->dev, & ASUS_OLED_DEVICE_ATTR(enabled));

Return to bug 210889