]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: Intel: catpt: Replace RAM-helpers with resource_xxx()
authorCezary Rojewski <cezary.rojewski@intel.com>
Wed, 3 Jun 2026 08:58:22 +0000 (10:58 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 4 Jun 2026 16:00:22 +0000 (17:00 +0100)
For catpt_sram_init(), the exact same functionality has been provided to
ioport.h with commit 9fb6fef0fb49 ("resource: Add resource set range and
size helpers") in recent years.

As for catpt_dram/iram_size(), leave it for the driver initialization
only.  Have all other manipulations be done using resource_xxx() API
which are more familiar to kernel developers.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20260603085827.1964796-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/catpt/core.h
sound/soc/intel/catpt/device.c
sound/soc/intel/catpt/loader.c

index 7e479ef89ad0b787f84159bea11a4dbadbb30f30..3881164422b88ff2b2a0658c8c524413f78e305f 100644 (file)
@@ -17,7 +17,6 @@ struct catpt_dev;
 
 extern const struct attribute_group *catpt_attr_groups[];
 
-void catpt_sram_init(struct resource *sram, u32 start, u32 size);
 void catpt_sram_free(struct resource *sram);
 struct resource *
 catpt_request_region(struct resource *root, resource_size_t size);
index b0a926db483c6cacbe4c65c5a637ce24a3a454f0..b176aebea9d528e5f0407292ad5712962673cd08 100644 (file)
@@ -233,12 +233,9 @@ static void catpt_dev_init(struct catpt_dev *cdev, struct device *dev,
        cdev->devfmt[CATPT_SSP_IFACE_0].iface = UINT_MAX;
        cdev->devfmt[CATPT_SSP_IFACE_1].iface = UINT_MAX;
 
+       resource_set_range(&cdev->dram, spec->host_dram_offset, catpt_dram_size(cdev));
+       resource_set_range(&cdev->iram, spec->host_iram_offset, catpt_iram_size(cdev));
        catpt_ipc_init(&cdev->ipc, dev);
-
-       catpt_sram_init(&cdev->dram, spec->host_dram_offset,
-                       catpt_dram_size(cdev));
-       catpt_sram_init(&cdev->iram, spec->host_iram_offset,
-                       catpt_iram_size(cdev));
 }
 
 static int catpt_acpi_probe(struct platform_device *pdev)
@@ -287,7 +284,7 @@ static int catpt_acpi_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       cdev->dxbuf_vaddr = dmam_alloc_coherent(dev, catpt_dram_size(cdev),
+       cdev->dxbuf_vaddr = dmam_alloc_coherent(dev, resource_size(&cdev->dram),
                                                &cdev->dxbuf_paddr, GFP_KERNEL);
        if (!cdev->dxbuf_vaddr)
                return -ENOMEM;
index 75457187b614ff52e153256de01b96554aaa2394..c577f2e17ddfbbcda6ad35fb991b72b35192d183 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/dma-mapping.h>
 #include <linux/firmware.h>
+#include <linux/ioport.h>
 #include <linux/slab.h>
 #include "core.h"
 #include "registers.h"
@@ -50,12 +51,6 @@ struct catpt_fw_block_hdr {
        u32 rsvd;
 } __packed;
 
-void catpt_sram_init(struct resource *sram, u32 start, u32 size)
-{
-       sram->start = start;
-       sram->end = start + size - 1;
-}
-
 void catpt_sram_free(struct resource *sram)
 {
        struct resource *res, *save;