drm/linux: Improve request_firmware() compatibility
authorFrançois Tigeot <ftigeot@wolfpond.org>
Fri, 25 Nov 2016 08:06:16 +0000 (09:06 +0100)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Fri, 25 Nov 2016 08:20:51 +0000 (09:20 +0100)
request_firmware() takes a pointer to a Linux struct device as
third parameter.

sys/dev/drm/include/linux/firmware.h
sys/dev/drm/radeon/cik.c
sys/dev/drm/radeon/ni.c
sys/dev/drm/radeon/r100.c
sys/dev/drm/radeon/r600.c
sys/dev/drm/radeon/radeon_uvd.c
sys/dev/drm/radeon/radeon_vce.c
sys/dev/drm/radeon/si.c

index 2f22bd2..34d6234 100644 (file)
 
 #include <sys/bus.h>
 #include <sys/firmware.h>
+#include <linux/types.h>
+#include <linux/compiler.h>
+#include <linux/gfp.h>
+#include <linux/device.h>
 
 static inline int
-request_firmware(const struct firmware **fw, const char *name, __unused device_t dev) {
+request_firmware(const struct firmware **fw, const char *name, __unused struct device *dev) {
        *fw = firmware_get(name);
        if (*fw) {
                return 0;
index 00dc512..d8947f4 100644 (file)
@@ -1971,10 +1971,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        DRM_INFO("Loading %s Microcode\n", new_chip_name);
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", new_chip_name);
-       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", chip_name);
-               err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
                if (err)
                        goto out;
                if (rdev->pfp_fw->datasize != pfp_req_size) {
@@ -1997,10 +1997,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", new_chip_name);
-       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", chip_name);
-               err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
                if (err)
                        goto out;
                if (rdev->me_fw->datasize != me_req_size) {
@@ -2022,10 +2022,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_ce", new_chip_name);
-       err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_ce", chip_name);
-               err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
                if (err)
                        goto out;
                if (rdev->ce_fw->datasize != ce_req_size) {
@@ -2047,10 +2047,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mec", new_chip_name);
-       err = request_firmware(&rdev->mec_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->mec_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mec", chip_name);
-               err = request_firmware(&rdev->mec_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->mec_fw, fw_name, rdev->dev);
                if (err)
                        goto out;
                if (rdev->mec_fw->datasize != mec_req_size) {
@@ -2073,7 +2073,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
 
        if (rdev->family == CHIP_KAVERI) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mec2", new_chip_name);
-               err = request_firmware(&rdev->mec2_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->mec2_fw, fw_name, rdev->dev);
                if (err) {
                        goto out;
                } else {
@@ -2087,10 +2087,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc", new_chip_name);
-       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc", chip_name);
-               err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
                if (err)
                        goto out;
                if (rdev->rlc_fw->datasize != rlc_req_size) {
@@ -2112,10 +2112,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_sdma", new_chip_name);
-       err = request_firmware(&rdev->sdma_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->sdma_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_sdma", chip_name);
-               err = request_firmware(&rdev->sdma_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->sdma_fw, fw_name, rdev->dev);
                if (err)
                        goto out;
                if (rdev->sdma_fw->datasize != sdma_req_size) {
@@ -2139,13 +2139,13 @@ static int cik_init_microcode(struct radeon_device *rdev)
        /* No SMC, MC ucode on APUs */
        if (!(rdev->flags & RADEON_IS_IGP)) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc", new_chip_name);
-               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
                if (err) {
                        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc2", chip_name);
-                       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
+                       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
                        if (err) {
                                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc", chip_name);
-                               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
+                               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
                                if (err)
                                        goto out;
                        }
@@ -2170,10 +2170,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
                }
 
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", new_chip_name);
-               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
                if (err) {
                        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", chip_name);
-                       err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
+                       err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
                        if (err) {
                                printk(KERN_ERR
                                       "smc: error loading firmware \"%s\"\n",
index e2e4148..8cac7eb 100644 (file)
@@ -728,7 +728,7 @@ int ni_init_microcode(struct radeon_device *rdev)
        DRM_INFO("Loading %s Microcode\n", chip_name);
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", chip_name);
-       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
        if (err)
                goto out;
        if (rdev->pfp_fw->datasize != pfp_req_size) {
@@ -740,7 +740,7 @@ int ni_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", chip_name);
-       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
        if (err)
                goto out;
        if (rdev->me_fw->datasize != me_req_size) {
@@ -752,7 +752,7 @@ int ni_init_microcode(struct radeon_device *rdev)
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc",
                  rlc_chip_name);
-       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
        if (err)
                goto out;
        if (rdev->rlc_fw->datasize != rlc_req_size) {
@@ -765,7 +765,7 @@ int ni_init_microcode(struct radeon_device *rdev)
        /* no MC ucode on TN */
        if (!(rdev->flags & RADEON_IS_IGP)) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc", chip_name);
-               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
                if (err)
                        goto out;
                if (rdev->mc_fw->datasize != mc_req_size) {
@@ -778,7 +778,7 @@ int ni_init_microcode(struct radeon_device *rdev)
 
        if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", chip_name);
-               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
                if (err) {
                        printk(KERN_ERR
                               "smc: error loading firmware \"%s\"\n",
index 86a1990..7ebb73d 100644 (file)
@@ -1025,7 +1025,7 @@ static int r100_cp_init_microcode(struct radeon_device *rdev)
                fw_name = FIRMWARE_R520;
        }
 
-       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
        if (err) {
                printk(KERN_ERR "radeon_cp: Failed to load firmware \"%s\"\n",
                       fw_name);
index df528a1..262c63a 100644 (file)
@@ -2466,7 +2466,7 @@ int r600_init_microcode(struct radeon_device *rdev)
        DRM_INFO("Loading %s Microcode\n", chip_name);
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", chip_name);
-       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
        if (err)
                goto out;
        if (rdev->pfp_fw->datasize != pfp_req_size) {
@@ -2478,7 +2478,7 @@ int r600_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", chip_name);
-       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
        if (err)
                goto out;
        if (rdev->me_fw->datasize != me_req_size) {
@@ -2489,7 +2489,7 @@ int r600_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc", rlc_chip_name);
-       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
        if (err)
                goto out;
        if (rdev->rlc_fw->datasize != rlc_req_size) {
@@ -2501,7 +2501,7 @@ int r600_init_microcode(struct radeon_device *rdev)
 
        if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", smc_chip_name);
-               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
                if (err) {
                        printk(KERN_ERR
                               "smc: error loading firmware \"%s\"\n",
index d882b3f..096420f 100644 (file)
@@ -129,7 +129,7 @@ int radeon_uvd_init(struct radeon_device *rdev)
                return -EINVAL;
        }
 
-       r = request_firmware(&rdev->uvd_fw, fw_name, rdev->dev->bsddev);
+       r = request_firmware(&rdev->uvd_fw, fw_name, rdev->dev);
        if (r) {
                dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n",
                        fw_name);
index d47c49e..026d6ed 100644 (file)
@@ -74,7 +74,7 @@ int radeon_vce_init(struct radeon_device *rdev)
                return -EINVAL;
        }
 
-       r = request_firmware(&rdev->vce_fw, fw_name, rdev->dev->bsddev);
+       r = request_firmware(&rdev->vce_fw, fw_name, rdev->dev);
        if (r) {
                dev_err(rdev->dev, "radeon_vce: Can't load firmware \"%s\"\n",
                        fw_name);
index 4d06f75..03c9bd9 100644 (file)
@@ -1674,10 +1674,10 @@ static int si_init_microcode(struct radeon_device *rdev)
        DRM_INFO("Loading %s Microcode\n", new_chip_name);
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", new_chip_name);
-       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", chip_name);
-               err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
                if (err)
                        goto out;
                if (rdev->pfp_fw->datasize != pfp_req_size) {
@@ -1700,10 +1700,10 @@ static int si_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", new_chip_name);
-       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", chip_name);
-               err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
                if (err)
                        goto out;
                if (rdev->me_fw->datasize != me_req_size) {
@@ -1725,10 +1725,10 @@ static int si_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_ce", new_chip_name);
-       err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_ce", chip_name);
-               err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
                if (err)
                        goto out;
                if (rdev->ce_fw->datasize != ce_req_size) {
@@ -1750,10 +1750,10 @@ static int si_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc", new_chip_name);
-       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc", chip_name);
-               err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
                if (err)
                        goto out;
                if (rdev->rlc_fw->datasize != rlc_req_size) {
@@ -1775,13 +1775,13 @@ static int si_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc", new_chip_name);
-       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc2", chip_name);
-               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
                if (err) {
                        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc", chip_name);
-                       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
+                       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
                        if (err)
                                goto out;
                }
@@ -1806,10 +1806,10 @@ static int si_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", new_chip_name);
-       err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
+       err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", chip_name);
-               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
+               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
                if (err) {
                        printk(KERN_ERR
                               "smc: error loading firmware \"%s\"\n",