mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	misc: sram: use devm_platform_ioremap_resource_wc()
Use the new devm_platform_ioremap_resource_wc() helper instead of devm_ioremap_wc() combinded with a call to platform_get_resource(). Also use devm_platform_ioremap_resource() where applicable. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20191022084318.22256-6-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
		
							parent
							
								
									bb6243b4f7
								
							
						
					
					
						commit
						444b0111f3
					
				
					 1 changed files with 8 additions and 20 deletions
				
			
		| 
						 | 
					@ -340,8 +340,6 @@ static const struct of_device_id sram_dt_ids[] = {
 | 
				
			||||||
static int sram_probe(struct platform_device *pdev)
 | 
					static int sram_probe(struct platform_device *pdev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct sram_dev *sram;
 | 
						struct sram_dev *sram;
 | 
				
			||||||
	struct resource *res;
 | 
					 | 
				
			||||||
	size_t size;
 | 
					 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
	int (*init_func)(void);
 | 
						int (*init_func)(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -351,25 +349,14 @@ static int sram_probe(struct platform_device *pdev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sram->dev = &pdev->dev;
 | 
						sram->dev = &pdev->dev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 | 
					 | 
				
			||||||
	if (!res) {
 | 
					 | 
				
			||||||
		dev_err(sram->dev, "found no memory resource\n");
 | 
					 | 
				
			||||||
		return -EINVAL;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	size = resource_size(res);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (!devm_request_mem_region(sram->dev, res->start, size, pdev->name)) {
 | 
					 | 
				
			||||||
		dev_err(sram->dev, "could not request region for resource\n");
 | 
					 | 
				
			||||||
		return -EBUSY;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (of_property_read_bool(pdev->dev.of_node, "no-memory-wc"))
 | 
						if (of_property_read_bool(pdev->dev.of_node, "no-memory-wc"))
 | 
				
			||||||
		sram->virt_base = devm_ioremap(sram->dev, res->start, size);
 | 
							sram->virt_base = devm_platform_ioremap_resource(pdev, 0);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		sram->virt_base = devm_ioremap_wc(sram->dev, res->start, size);
 | 
							sram->virt_base = devm_platform_ioremap_resource_wc(pdev, 0);
 | 
				
			||||||
	if (!sram->virt_base)
 | 
						if (IS_ERR(sram->virt_base)) {
 | 
				
			||||||
		return -ENOMEM;
 | 
							dev_err(&pdev->dev, "could not map SRAM registers\n");
 | 
				
			||||||
 | 
							return PTR_ERR(sram->virt_base);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sram->pool = devm_gen_pool_create(sram->dev, ilog2(SRAM_GRANULARITY),
 | 
						sram->pool = devm_gen_pool_create(sram->dev, ilog2(SRAM_GRANULARITY),
 | 
				
			||||||
					  NUMA_NO_NODE, NULL);
 | 
										  NUMA_NO_NODE, NULL);
 | 
				
			||||||
| 
						 | 
					@ -382,7 +369,8 @@ static int sram_probe(struct platform_device *pdev)
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		clk_prepare_enable(sram->clk);
 | 
							clk_prepare_enable(sram->clk);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = sram_reserve_regions(sram, res);
 | 
						ret = sram_reserve_regions(sram,
 | 
				
			||||||
 | 
								platform_get_resource(pdev, IORESOURCE_MEM, 0));
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		goto err_disable_clk;
 | 
							goto err_disable_clk;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue