mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-03 21:48:15 +00:00 
			
		
		
		
	net: ksz9477: remove dev_set_parent_priv() call
The ksz9477 is currently the only driver using dev_set_parent_priv() outside of the driver model. Also, there was no explanation in the commit adding ksz9477 driver and why dev_set_parent_priv() is required. Actually there is a typo in ksz_mdio_probe() while retrieving the parent (switch@0) private data: - priv->ksz = dev_get_parent_priv(dev->parent); + priv->ksz = dev_get_priv(dev->parent); Printing the address of struct ksz_dsa_priv *priv allows to notice the slight difference: ksz_i2c_probe: ksz_dsa_priv *priv 0xfdf45768 // address of the saved priv ksz_mdio_bind: ksz_dsa_priv *priv 0xfdf45798 // address returned by dev_get_parent_priv(dev->parent) ksz_mdio_bind: ksz_dsa_priv *priv 0xfdf45768 // address returned by dev_get_priv(dev->parent) The ksz_mdio driver get the wrong data and without dev_set_parent_priv() the mdio driver fail to access the underlying bus. While it doesn't cause any issue with I2C bus, it override the per-child data used by the SPI bus (struct spi_slave) and prevent further bus access (even with sspi command). Signed-off-by: Romain Naour <romain.naour@smile.fr>
This commit is contained in:
		
							parent
							
								
									6df5c5aee3
								
							
						
					
					
						commit
						5b87af441f
					
				@ -276,7 +276,7 @@ static int ksz_mdio_probe(struct udevice *dev)
 | 
				
			|||||||
	struct ksz_mdio_priv *priv = dev_get_priv(dev);
 | 
						struct ksz_mdio_priv *priv = dev_get_priv(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dev_dbg(dev, "%s\n", __func__);
 | 
						dev_dbg(dev, "%s\n", __func__);
 | 
				
			||||||
	priv->ksz = dev_get_parent_priv(dev->parent);
 | 
						priv->ksz = dev_get_priv(dev->parent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -514,8 +514,6 @@ static int ksz_i2c_probe(struct udevice *dev)
 | 
				
			|||||||
	u8 data8;
 | 
						u8 data8;
 | 
				
			||||||
	u32 id;
 | 
						u32 id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dev_set_parent_priv(dev, priv);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ret = i2c_set_chip_offset_len(dev, 2);
 | 
						ret = i2c_set_chip_offset_len(dev, 2);
 | 
				
			||||||
	if (ret) {
 | 
						if (ret) {
 | 
				
			||||||
		printf("i2c_set_chip_offset_len failed: %d\n", ret);
 | 
							printf("i2c_set_chip_offset_len failed: %d\n", ret);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user