File drivers/gpu/alga/amd/dce6/sysfs.c changed (mode: 100644) (index b93ad46..d1781ca) |
... |
... |
static const struct attribute_group *edid_attr_groups[] = { |
210 |
210 |
}; |
}; |
211 |
211 |
/*============================================================================*/ |
/*============================================================================*/ |
212 |
212 |
|
|
213 |
|
static void dce6_display_release(struct device *dev) |
|
214 |
|
{ |
|
215 |
|
kfree(dev); |
|
216 |
|
} |
|
217 |
|
|
|
218 |
213 |
int sysfs_add(struct dce6 *dce, unsigned i) |
int sysfs_add(struct dce6 *dce, unsigned i) |
219 |
214 |
{ |
{ |
220 |
215 |
int id; |
int id; |
|
... |
... |
int sysfs_add(struct dce6 *dce, unsigned i) |
242 |
237 |
|
|
243 |
238 |
d->class = class; |
d->class = class; |
244 |
239 |
d->parent = dce->parent_char_dev; |
d->parent = dce->parent_char_dev; |
245 |
|
d->release = dce6_display_release; |
|
246 |
240 |
|
|
247 |
241 |
sysfs_attr_init(&dev_attr_manufacturer.attr); |
sysfs_attr_init(&dev_attr_manufacturer.attr); |
248 |
242 |
sysfs_attr_init(&dev_attr_product_code.attr); |
sysfs_attr_init(&dev_attr_product_code.attr); |
|
... |
... |
int sysfs_add(struct dce6 *dce, unsigned i) |
260 |
254 |
r = device_register(d); |
r = device_register(d); |
261 |
255 |
if (r != 0) { |
if (r != 0) { |
262 |
256 |
dev_err(dce->ddev.dev, "dce6:dp%u:unable to register display" |
dev_err(dce->ddev.dev, "dce6:dp%u:unable to register display" |
263 |
|
" device name\n",i); |
|
|
257 |
|
" device\n",i); |
264 |
258 |
goto err_put_dev; |
goto err_put_dev; |
265 |
259 |
} |
} |
266 |
260 |
|
|
File drivers/gpu/alga/amd/si/drv.c changed (mode: 100644) (index 08b5afa..c743ad3) |
... |
... |
static void cfg_init(struct pci_dev *dev) |
195 |
195 |
gpu_cfg_init(dev); |
gpu_cfg_init(dev); |
196 |
196 |
} |
} |
197 |
197 |
|
|
|
198 |
|
static ssize_t discret_vram_show(struct device *dev, |
|
199 |
|
struct device_attribute *attr, char *buf) |
|
200 |
|
{ |
|
201 |
|
struct dev_drv_data *dd; |
|
202 |
|
|
|
203 |
|
dd = dev_get_drvdata(dev); |
|
204 |
|
|
|
205 |
|
return scnprintf(buf, PAGE_SIZE, "%llu", dd->vram.mng.sz); |
|
206 |
|
} |
|
207 |
|
|
|
208 |
|
/*----------------------------------------------------------------------------*/ |
|
209 |
|
static DEVICE_ATTR(discret_vram, S_IRUGO, discret_vram_show, NULL); |
|
210 |
|
|
|
211 |
|
static struct attribute *char_dev_attrs[] = { |
|
212 |
|
&dev_attr_discret_vram.attr, |
|
213 |
|
NULL |
|
214 |
|
}; |
|
215 |
|
static struct attribute_group char_dev_attr_group = { |
|
216 |
|
.attrs = &char_dev_attrs[0] |
|
217 |
|
}; |
|
218 |
|
static const struct attribute_group *char_dev_attr_groups[] = { |
|
219 |
|
&char_dev_attr_group, |
|
220 |
|
NULL |
|
221 |
|
}; |
|
222 |
|
/*----------------------------------------------------------------------------*/ |
|
223 |
|
|
|
224 |
|
static int char_dev_register(struct dev_drv_data *dd) |
|
225 |
|
{ |
|
226 |
|
int r; |
|
227 |
|
|
|
228 |
|
memset(&dd->char_dev, 0, sizeof(dd->char_dev)); |
|
229 |
|
|
|
230 |
|
dd->char_dev.devt = dd->char_cdev.dev; |
|
231 |
|
dd->char_dev.class = class; |
|
232 |
|
dd->char_dev.parent = &dd->dev->dev; |
|
233 |
|
dev_set_drvdata(&dd->char_dev, dd); |
|
234 |
|
|
|
235 |
|
sysfs_attr_init(&dev_attr_discret_vram_show.attr); |
|
236 |
|
dd->char_dev.groups = &char_dev_attr_groups[0]; |
|
237 |
|
|
|
238 |
|
r = dev_set_name(&dd->char_dev, "si%u", dd->minor); |
|
239 |
|
if (r != 0) { |
|
240 |
|
dev_err(&dd->dev->dev, "unable to set char device name\n"); |
|
241 |
|
goto err_put_dev; |
|
242 |
|
} |
|
243 |
|
|
|
244 |
|
r = device_register(&dd->char_dev); |
|
245 |
|
if (r != 0) { |
|
246 |
|
dev_err(&dd->dev->dev, "unable to register char device\n"); |
|
247 |
|
goto err_put_dev; |
|
248 |
|
} |
|
249 |
|
return 0; |
|
250 |
|
|
|
251 |
|
err_put_dev: |
|
252 |
|
put_device(&dd->char_dev); |
|
253 |
|
return -SI_ERR; |
|
254 |
|
} |
|
255 |
|
|
198 |
256 |
static int probe(struct pci_dev *dev, const struct pci_device_id *id) |
static int probe(struct pci_dev *dev, const struct pci_device_id *id) |
199 |
257 |
{ |
{ |
200 |
258 |
int r; |
int r; |
|
... |
... |
static int probe(struct pci_dev *dev, const struct pci_device_id *id) |
436 |
494 |
goto err_free_minor; |
goto err_free_minor; |
437 |
495 |
} |
} |
438 |
496 |
|
|
439 |
|
dd->char_dev = device_create(class, &dev->dev, dd->char_cdev.dev, NULL, |
|
440 |
|
"si%u", dd->minor); |
|
441 |
|
if (IS_ERR(dd->char_dev)) { |
|
442 |
|
dev_err(&dev->dev, "cannot create userspace char device\n"); |
|
|
497 |
|
r = char_dev_register(dd); |
|
498 |
|
if (r) |
443 |
499 |
goto err_cdev_del; |
goto err_cdev_del; |
444 |
|
} |
|
445 |
500 |
|
|
446 |
|
r = dce6_sysfs_init(dd->dce, dd->char_dev); |
|
|
501 |
|
r = dce6_sysfs_init(dd->dce, &dd->char_dev); |
447 |
502 |
if (r) { |
if (r) { |
448 |
|
goto err_destroy_device; |
|
|
503 |
|
goto err_unregister_device; |
449 |
504 |
} |
} |
450 |
505 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
451 |
506 |
|
|
|
... |
... |
static int probe(struct pci_dev *dev, const struct pci_device_id *id) |
456 |
511 |
dev_info(&dev->dev, "ready\n"); |
dev_info(&dev->dev, "ready\n"); |
457 |
512 |
return 0; |
return 0; |
458 |
513 |
|
|
459 |
|
err_destroy_device: |
|
460 |
|
device_destroy(class, dd->char_cdev.dev); |
|
|
514 |
|
err_unregister_device: |
|
515 |
|
device_unregister(&dd->char_dev); |
461 |
516 |
|
|
462 |
517 |
err_cdev_del: |
err_cdev_del: |
463 |
518 |
cdev_del(&dd->char_cdev); |
cdev_del(&dd->char_cdev); |
|
... |
... |
static void remove(struct pci_dev *dev) |
532 |
587 |
dd = pci_get_drvdata(dev); |
dd = pci_get_drvdata(dev); |
533 |
588 |
|
|
534 |
589 |
/* remove userland interface */ |
/* remove userland interface */ |
535 |
|
device_destroy(class, dd->char_cdev.dev); |
|
|
590 |
|
device_unregister(&dd->char_dev); |
536 |
591 |
cdev_del(&dd->char_cdev); |
cdev_del(&dd->char_cdev); |
537 |
592 |
ida_simple_remove(&ida, dd->minor); |
ida_simple_remove(&ida, dd->minor); |
538 |
593 |
|
|