mmc: mmc-uclass: Use dev_seq() to read aliases node's index
Use dev_seq() to read aliases node's index and pass it as device number for creating bulk device. Suggested-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
This commit is contained in:
		
							parent
							
								
									2153a08a24
								
							
						
					
					
						commit
						2243d19e56
					
				| 
						 | 
					@ -383,18 +383,16 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct blk_desc *bdesc;
 | 
						struct blk_desc *bdesc;
 | 
				
			||||||
	struct udevice *bdev;
 | 
						struct udevice *bdev;
 | 
				
			||||||
	int ret, devnum = -1;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!mmc_get_ops(dev))
 | 
						if (!mmc_get_ops(dev))
 | 
				
			||||||
		return -ENOSYS;
 | 
							return -ENOSYS;
 | 
				
			||||||
#ifndef CONFIG_SPL_BUILD
 | 
					
 | 
				
			||||||
	/* Use the fixed index with aliase node's index */
 | 
						/* Use the fixed index with aliases node's index */
 | 
				
			||||||
	ret = dev_read_alias_seq(dev, &devnum);
 | 
						debug("%s: alias devnum=%d\n", __func__, dev_seq(dev));
 | 
				
			||||||
	debug("%s: alias ret=%d, devnum=%d\n", __func__, ret, devnum);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = blk_create_devicef(dev, "mmc_blk", "blk", IF_TYPE_MMC,
 | 
						ret = blk_create_devicef(dev, "mmc_blk", "blk", IF_TYPE_MMC,
 | 
				
			||||||
			devnum, 512, 0, &bdev);
 | 
								dev_seq(dev), 512, 0, &bdev);
 | 
				
			||||||
	if (ret) {
 | 
						if (ret) {
 | 
				
			||||||
		debug("Cannot create block device\n");
 | 
							debug("Cannot create block device\n");
 | 
				
			||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue