Displaying 20 results from an estimated 25 matches for "drm_dev_init".
2020 Mar 02
2
[PATCH 09/51] drm/cirrus: Use drmm_add_final_kfree
...uct drm_device *dev)
{
- struct cirrus_device *cirrus = dev->dev_private;
-
drm_mode_config_cleanup(dev);
- kfree(cirrus);
+ drm_dev_fini(dev);
}
DEFINE_DRM_GEM_FOPS(cirrus_fops);
@@ -575,9 +574,12 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
dev = &cirrus->dev;
ret = drm_dev_init(dev, &cirrus_driver, &pdev->dev);
- if (ret)
- goto err_free_cirrus;
+ if (ret) {
+ kfree(cirrus);
+ goto err_pci_release;
+ }
dev->dev_private = cirrus;
+ drmm_add_final_kfree(dev, cirrus);
ret = -ENOMEM;
cirrus->vram = ioremap(pci_resource_start(pdev, 0),
@@ -618,8 +62...
2020 Mar 02
2
[PATCH 09/51] drm/cirrus: Use drmm_add_final_kfree
...uct drm_device *dev)
{
- struct cirrus_device *cirrus = dev->dev_private;
-
drm_mode_config_cleanup(dev);
- kfree(cirrus);
+ drm_dev_fini(dev);
}
DEFINE_DRM_GEM_FOPS(cirrus_fops);
@@ -575,9 +574,12 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
dev = &cirrus->dev;
ret = drm_dev_init(dev, &cirrus_driver, &pdev->dev);
- if (ret)
- goto err_free_cirrus;
+ if (ret) {
+ kfree(cirrus);
+ goto err_pci_release;
+ }
dev->dev_private = cirrus;
+ drmm_add_final_kfree(dev, cirrus);
ret = -ENOMEM;
cirrus->vram = ioremap(pci_resource_start(pdev, 0),
@@ -618,8 +62...
2020 Apr 15
2
[PATCH 26/59] drm/qxl: Use devm_drm_dev_alloc
....91a34dd835d7 100644
--- a/drivers/gpu/drm/qxl/qxl_kms.c
+++ b/drivers/gpu/drm/qxl/qxl_kms.c
@@ -108,21 +108,13 @@ static void qxl_gc_work(struct work_struct *work)
}
int qxl_device_init(struct qxl_device *qdev,
- struct drm_driver *drv,
struct pci_dev *pdev)
{
int r, sb;
- r = drm_dev_init(&qdev->ddev, drv, &pdev->dev);
- if (r) {
- pr_err("Unable to init drm dev");
- goto error;
- }
-
qdev->ddev.pdev = pdev;
pci_set_drvdata(pdev, &qdev->ddev);
qdev->ddev.dev_private = qdev;
- drmm_add_final_kfree(&qdev->ddev, qdev);
mutex_init(...
2020 Apr 15
2
[PATCH 26/59] drm/qxl: Use devm_drm_dev_alloc
....91a34dd835d7 100644
--- a/drivers/gpu/drm/qxl/qxl_kms.c
+++ b/drivers/gpu/drm/qxl/qxl_kms.c
@@ -108,21 +108,13 @@ static void qxl_gc_work(struct work_struct *work)
}
int qxl_device_init(struct qxl_device *qdev,
- struct drm_driver *drv,
struct pci_dev *pdev)
{
int r, sb;
- r = drm_dev_init(&qdev->ddev, drv, &pdev->dev);
- if (r) {
- pr_err("Unable to init drm dev");
- goto error;
- }
-
qdev->ddev.pdev = pdev;
pci_set_drvdata(pdev, &qdev->ddev);
qdev->ddev.dev_private = qdev;
- drmm_add_final_kfree(&qdev->ddev, qdev);
mutex_init(...
2020 Apr 03
3
[PATCH 30/44] drm/qxl: Use devm_drm_dev_alloc
....91a34dd835d7 100644
--- a/drivers/gpu/drm/qxl/qxl_kms.c
+++ b/drivers/gpu/drm/qxl/qxl_kms.c
@@ -108,21 +108,13 @@ static void qxl_gc_work(struct work_struct *work)
}
int qxl_device_init(struct qxl_device *qdev,
- struct drm_driver *drv,
struct pci_dev *pdev)
{
int r, sb;
- r = drm_dev_init(&qdev->ddev, drv, &pdev->dev);
- if (r) {
- pr_err("Unable to init drm dev");
- goto error;
- }
-
qdev->ddev.pdev = pdev;
pci_set_drvdata(pdev, &qdev->ddev);
qdev->ddev.dev_private = qdev;
- drmm_add_final_kfree(&qdev->ddev, qdev);
mutex_init(...
2020 Apr 03
3
[PATCH 30/44] drm/qxl: Use devm_drm_dev_alloc
....91a34dd835d7 100644
--- a/drivers/gpu/drm/qxl/qxl_kms.c
+++ b/drivers/gpu/drm/qxl/qxl_kms.c
@@ -108,21 +108,13 @@ static void qxl_gc_work(struct work_struct *work)
}
int qxl_device_init(struct qxl_device *qdev,
- struct drm_driver *drv,
struct pci_dev *pdev)
{
int r, sb;
- r = drm_dev_init(&qdev->ddev, drv, &pdev->dev);
- if (r) {
- pr_err("Unable to init drm dev");
- goto error;
- }
-
qdev->ddev.pdev = pdev;
pci_set_drvdata(pdev, &qdev->ddev);
qdev->ddev.dev_private = qdev;
- drmm_add_final_kfree(&qdev->ddev, qdev);
mutex_init(...
2020 Feb 10
1
[PATCH v2 2/2] drm/qxl: add drm_driver.release callback.
...remove hook. Since that's guaranteed to be gone at
> that point, so anything in ->release that still needs the device is
> broken. Ofc maybe do that check only for drivers which have a ->release
> hook, and we might need a few fixups.
>
We take a ref on the parent device in drm_dev_init() and release it in
drm_dev_fini(). I added this because of the DRM_DEV_* macros we have, to
protect access to the device struct after it was unregistered. Setting
drm_device->dev to NULL in drm_dev_unregister() instead will provide the
same protection I think.
commit 56be6503aab2
drm/drv: Hold...
2020 Apr 28
2
[PATCH 26/59] drm/qxl: Use devm_drm_dev_alloc
...t; @@ -108,21 +108,13 @@ static void qxl_gc_work(struct work_struct *work)
> > }
> >
> > int qxl_device_init(struct qxl_device *qdev,
> > - struct drm_driver *drv,
> > struct pci_dev *pdev)
> > {
> > int r, sb;
> >
> > - r = drm_dev_init(&qdev->ddev, drv, &pdev->dev);
> > - if (r) {
> > - pr_err("Unable to init drm dev");
> > - goto error;
> > - }
> > -
> > qdev->ddev.pdev = pdev;
> > pci_set_drvdata(pdev, &qdev->ddev);
> > qdev->ddev.dev_p...
2020 Apr 28
2
[PATCH 26/59] drm/qxl: Use devm_drm_dev_alloc
...t; @@ -108,21 +108,13 @@ static void qxl_gc_work(struct work_struct *work)
> > }
> >
> > int qxl_device_init(struct qxl_device *qdev,
> > - struct drm_driver *drv,
> > struct pci_dev *pdev)
> > {
> > int r, sb;
> >
> > - r = drm_dev_init(&qdev->ddev, drv, &pdev->dev);
> > - if (r) {
> > - pr_err("Unable to init drm dev");
> > - goto error;
> > - }
> > -
> > qdev->ddev.pdev = pdev;
> > pci_set_drvdata(pdev, &qdev->ddev);
> > qdev->ddev.dev_p...
2020 Feb 25
7
[PATCH 0/3] Add separate non-KMS state; constify struct drm_driver
This patchset moves legacy, non-KMS driver state from struct drm_driver
into struct drm_legacy_state. Only non-KMS drivers provide an instance
of the latter structure. One special case is nouveau, which supports
legacy interfaces. It also provides an instance of the legacy state if
the legacy interfaces have been enabled (i.e., defines the config option
CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT)
I
2020 Feb 19
0
[PATCH 10/52] drm/cirrus: Use drmm_add_final_kfree
...uct drm_device *dev)
{
- struct cirrus_device *cirrus = dev->dev_private;
-
drm_mode_config_cleanup(dev);
- kfree(cirrus);
+ drm_dev_fini(dev);
}
DEFINE_DRM_GEM_FOPS(cirrus_fops);
@@ -575,9 +574,12 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
dev = &cirrus->dev;
ret = drm_dev_init(dev, &cirrus_driver, &pdev->dev);
- if (ret)
- goto err_free_cirrus;
+ if (ret) {
+ kfree(cirrus);
+ goto err_pci_release;
+ }
dev->dev_private = cirrus;
+ drmm_add_final_kfree(dev, cirrus);
ret = -ENOMEM;
cirrus->vram = ioremap(pci_resource_start(pdev, 0),
@@ -618,8 +62...
2020 Mar 03
0
[PATCH 09/51] drm/cirrus: Use drmm_add_final_kfree
> @@ -575,9 +574,12 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
>
> dev = &cirrus->dev;
> ret = drm_dev_init(dev, &cirrus_driver, &pdev->dev);
> - if (ret)
> - goto err_free_cirrus;
> + if (ret) {
> + kfree(cirrus);
> + goto err_pci_release;
> + }
> dev->dev_private = cirrus;
> + drmm_add_final_kfree(dev, cirrus);
That doesn't look like an error path improve...
2020 Feb 19
0
[PATCH 31/52] drm/cirrus: Fully embrace devm_
...ret = pcim_enable_device(pdev);
if (ret)
return ret;
@@ -569,39 +569,38 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
ret = -ENOMEM;
cirrus = kzalloc(sizeof(*cirrus), GFP_KERNEL);
if (cirrus == NULL)
- goto err_pci_release;
+ return ret;
dev = &cirrus->dev;
- ret = drm_dev_init(dev, &cirrus_driver, &pdev->dev);
+ ret = devm_drm_dev_init(&pdev->dev, dev, &cirrus_driver);
if (ret) {
kfree(cirrus);
- goto err_pci_release;
+ return ret;
}
dev->dev_private = cirrus;
drmm_add_final_kfree(dev, cirrus);
- ret = -ENOMEM;
- cirrus->vram =...
2020 Mar 02
1
[PATCH 30/51] drm/cirrus: Fully embrace devm_
...ret = pcim_enable_device(pdev);
if (ret)
return ret;
@@ -569,39 +569,38 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
ret = -ENOMEM;
cirrus = kzalloc(sizeof(*cirrus), GFP_KERNEL);
if (cirrus == NULL)
- goto err_pci_release;
+ return ret;
dev = &cirrus->dev;
- ret = drm_dev_init(dev, &cirrus_driver, &pdev->dev);
+ ret = devm_drm_dev_init(&pdev->dev, dev, &cirrus_driver);
if (ret) {
kfree(cirrus);
- goto err_pci_release;
+ return ret;
}
dev->dev_private = cirrus;
drmm_add_final_kfree(dev, cirrus);
- ret = -ENOMEM;
- cirrus->vram =...
2020 Apr 24
0
[PATCH 26/59] drm/qxl: Use devm_drm_dev_alloc
...c
> +++ b/drivers/gpu/drm/qxl/qxl_kms.c
> @@ -108,21 +108,13 @@ static void qxl_gc_work(struct work_struct *work)
> }
>
> int qxl_device_init(struct qxl_device *qdev,
> - struct drm_driver *drv,
> struct pci_dev *pdev)
> {
> int r, sb;
>
> - r = drm_dev_init(&qdev->ddev, drv, &pdev->dev);
> - if (r) {
> - pr_err("Unable to init drm dev");
> - goto error;
> - }
> -
> qdev->ddev.pdev = pdev;
> pci_set_drvdata(pdev, &qdev->ddev);
> qdev->ddev.dev_private = qdev;
> - drmm_add_final_kfr...
2020 Apr 06
0
[PATCH 30/44] drm/qxl: Use devm_drm_dev_alloc
...c
> +++ b/drivers/gpu/drm/qxl/qxl_kms.c
> @@ -108,21 +108,13 @@ static void qxl_gc_work(struct work_struct *work)
> }
>
> int qxl_device_init(struct qxl_device *qdev,
> - struct drm_driver *drv,
> struct pci_dev *pdev)
> {
> int r, sb;
>
> - r = drm_dev_init(&qdev->ddev, drv, &pdev->dev);
> - if (r) {
> - pr_err("Unable to init drm dev");
> - goto error;
> - }
> -
> qdev->ddev.pdev = pdev;
> pci_set_drvdata(pdev, &qdev->ddev);
> qdev->ddev.dev_private = qdev;
> - drmm_add_final_kfr...
2020 Feb 25
1
[PATCH 1/3] drm: Add separate state structure for legacy, non-KMS drivers
...legacy.h | 6 ++++++
> 11 files changed, 49 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 7b1a628d1f6e..4ba0df097602 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -625,6 +625,10 @@ int drm_dev_init(struct drm_device *dev,
> if (WARN_ON(!parent))
> return -EINVAL;
>
> + if (drm_core_check_feature(dev, DRIVER_LEGACY) &&
> + WARN_ON(!driver->legacy))
> + return -EINVAL;
> +
> kref_init(&dev->r...
2020 Apr 28
0
[PATCH 26/59] drm/qxl: Use devm_drm_dev_alloc
...ork(struct work_struct *work)
> > > }
> > >
> > > int qxl_device_init(struct qxl_device *qdev,
> > > - struct drm_driver *drv,
> > > struct pci_dev *pdev)
> > > {
> > > int r, sb;
> > >
> > > - r = drm_dev_init(&qdev->ddev, drv, &pdev->dev);
> > > - if (r) {
> > > - pr_err("Unable to init drm dev");
> > > - goto error;
> > > - }
> > > -
> > > qdev->ddev.pdev = pdev;
> > > pci_set_drvdata(pdev, &qdev->dde...
2018 Jul 27
1
[PATCH] drm: qxl: Fix error handling at qxl_device_init
...tions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c
index 771250aed78d..e25c589d5f50 100644
--- a/drivers/gpu/drm/qxl/qxl_kms.c
+++ b/drivers/gpu/drm/qxl/qxl_kms.c
@@ -102,8 +102,10 @@ int qxl_device_init(struct qxl_device *qdev,
int r, sb;
r = drm_dev_init(&qdev->ddev, drv, &pdev->dev);
- if (r)
- return r;
+ if (r) {
+ pr_err("Unable to init drm dev");
+ goto error;
+ }
qdev->ddev.pdev = pdev;
pci_set_drvdata(pdev, &qdev->ddev);
@@ -121,6 +123,11 @@ int qxl_device_init(struct qxl_device *qdev,
qdev->io...
2020 Feb 25
0
[PATCH 2/3] drm: Move non-kms driver state into struct drm_legacy_state
...legacy->context_dtor(dev, ctx->handle);
drm_legacy_ctxbitmap_free(dev, ctx->handle);
}
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 4ba0df097602..4875b76e7656 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -625,14 +625,14 @@ int drm_dev_init(struct drm_device *dev,
if (WARN_ON(!parent))
return -EINVAL;
- if (drm_core_check_feature(dev, DRIVER_LEGACY) &&
- WARN_ON(!driver->legacy))
- return -EINVAL;
-
kref_init(&dev->ref);
dev->dev = get_device(parent);
dev->driver = driver;
+ if (drm_core_che...