dm: Use access methods for dev/uclass private data

Most drivers use these access methods but a few do not. Update them.

In some cases the access is not permitted, so mark those with a FIXME tag
for the maintainer to check.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pratyush Yadav <p.yadav@ti.com>
This commit is contained in:
Simon Glass
2020-12-22 19:30:28 -07:00
parent 12559f5bab
commit 0fd3d91152
113 changed files with 372 additions and 278 deletions

View File

@@ -1860,10 +1860,18 @@ static int rndis_control_ack(struct eth_device *net)
static int rndis_control_ack(struct udevice *net)
#endif
{
struct ether_priv *priv = (struct ether_priv *)net->priv;
struct eth_dev *dev = &priv->ethdev;
int length;
struct usb_request *resp = dev->stat_req;
struct ether_priv *priv;
struct eth_dev *dev;
int length;
struct usb_request *resp;
#ifndef CONFIG_DM_ETH
priv = (struct ether_priv *)net->priv;
#else
priv = dev_get_priv(net);
#endif
dev = &priv->ethdev;
resp = dev->stat_req;
/* in case RNDIS calls this after disconnect */
if (!dev->status) {

View File

@@ -60,7 +60,7 @@ int submit_control_msg(struct usb_device *udev, unsigned long pipe,
{
struct udevice *bus = udev->controller_dev;
struct dm_usb_ops *ops = usb_get_ops(bus);
struct usb_uclass_priv *uc_priv = bus->uclass->priv;
struct usb_uclass_priv *uc_priv = uclass_get_priv(bus->uclass);
int err;
if (!ops->control)
@@ -184,7 +184,7 @@ int usb_stop(void)
if (ret)
return ret;
uc_priv = uc->priv;
uc_priv = uclass_get_priv(uc);
uclass_foreach_dev(bus, uc) {
ret = device_remove(bus, DM_REMOVE_NORMAL);
@@ -263,7 +263,7 @@ int usb_init(void)
if (ret)
return ret;
uc_priv = uc->priv;
uc_priv = uclass_get_priv(uc);
uclass_foreach_dev(bus, uc) {
/* init low_level USB */