mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
drm/radeon: change drm_dev_alloc to devm_drm_dev_alloc
"drm_dev_alloc" is deprecated, in order to use the newer "devm_drm_dev_alloc", the "drm_device" is stored inside "radeon_device", by changing "rdev_to_drm(rdev)" other functions still gain access to the member "drm_device". Also, "devm_drm_dev_alloc" is now allocating "radeon_device", allocation inside "radeon_driver_load_kms" has to be removed. In "radeon_device_init", it originally assigned "rdev->dev" etc. However it is already done right after "devm_drm_dev_alloc" as you can see down below. It is better remove them. Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Tested-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Wu Hoi Pok <wuhoipok@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
fb1b5e1dd5
commit
a9ed2f052c
@ -2297,7 +2297,7 @@ typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t);
|
||||
|
||||
struct radeon_device {
|
||||
struct device *dev;
|
||||
struct drm_device *ddev;
|
||||
struct drm_device ddev;
|
||||
struct pci_dev *pdev;
|
||||
#ifdef __alpha__
|
||||
struct pci_controller *hose;
|
||||
@ -2478,7 +2478,7 @@ void cik_mm_wdoorbell(struct radeon_device *rdev, u32 index, u32 v);
|
||||
|
||||
static inline struct drm_device *rdev_to_drm(struct radeon_device *rdev)
|
||||
{
|
||||
return rdev->ddev;
|
||||
return &rdev->ddev;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1285,9 +1285,6 @@ int radeon_device_init(struct radeon_device *rdev,
|
||||
bool runtime = false;
|
||||
|
||||
rdev->shutdown = false;
|
||||
rdev->dev = &pdev->dev;
|
||||
rdev->ddev = ddev;
|
||||
rdev->pdev = pdev;
|
||||
rdev->flags = flags;
|
||||
rdev->family = flags & RADEON_FAMILY_MASK;
|
||||
rdev->is_atom_bios = false;
|
||||
|
@ -260,6 +260,7 @@ static int radeon_pci_probe(struct pci_dev *pdev,
|
||||
{
|
||||
unsigned long flags = 0;
|
||||
struct drm_device *ddev;
|
||||
struct radeon_device *rdev;
|
||||
int ret;
|
||||
|
||||
if (!ent)
|
||||
@ -300,9 +301,14 @@ static int radeon_pci_probe(struct pci_dev *pdev,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ddev = drm_dev_alloc(&kms_driver, &pdev->dev);
|
||||
if (IS_ERR(ddev))
|
||||
return PTR_ERR(ddev);
|
||||
rdev = devm_drm_dev_alloc(&pdev->dev, &kms_driver, typeof(*rdev), ddev);
|
||||
if (IS_ERR(rdev))
|
||||
return PTR_ERR(rdev);
|
||||
|
||||
rdev->dev = &pdev->dev;
|
||||
rdev->pdev = pdev;
|
||||
ddev = rdev_to_drm(rdev);
|
||||
ddev->dev_private = rdev;
|
||||
|
||||
ret = pci_enable_device(pdev);
|
||||
if (ret)
|
||||
|
@ -104,15 +104,9 @@ done_free:
|
||||
int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev->dev);
|
||||
struct radeon_device *rdev;
|
||||
struct radeon_device *rdev = dev->dev_private;
|
||||
int r, acpi_status;
|
||||
|
||||
rdev = kzalloc(sizeof(struct radeon_device), GFP_KERNEL);
|
||||
if (rdev == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
dev->dev_private = (void *)rdev;
|
||||
|
||||
#ifdef __alpha__
|
||||
rdev->hose = pdev->sysdata;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user