Re: [PATCHv7 04/19] usb: otg: ab8500: Start using struct usb_otg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, Nov 08, 2011 at 03:55:19PM +0200, Heikki Krogerus wrote:
> Use struct usb_otg members with OTG specific functions instead
> of usb_phy members.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> Acked-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@xxxxxxxxxxxxxx>
> ---
>  drivers/usb/otg/ab8500-usb.c |   89 +++++++++++++++++++++++-------------------
>  1 files changed, 49 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c
> index 366c3af..f60dd51 100644
> --- a/drivers/usb/otg/ab8500-usb.c
> +++ b/drivers/usb/otg/ab8500-usb.c
> @@ -68,7 +68,7 @@ enum ab8500_usb_link_status {
>  };
>  
>  struct ab8500_usb {
> -	struct usb_phy otg;
> +	struct usb_phy phy;
>  	struct device *dev;
>  	int irq_num_id_rise;
>  	int irq_num_id_fall;
> @@ -82,9 +82,9 @@ struct ab8500_usb {
>  	int rev;
>  };
>  
> -static inline struct ab8500_usb *xceiv_to_ab(struct usb_phy *x)
> +static inline struct ab8500_usb *phy_to_ab(struct usb_phy *x)
>  {
> -	return container_of(x, struct ab8500_usb, otg);
> +	return container_of(x, struct ab8500_usb, phy);
>  }
>  
>  static void ab8500_usb_wd_workaround(struct ab8500_usb *ab)
> @@ -169,8 +169,8 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
>  		/* TODO: Disable regulators. */
>  		ab8500_usb_host_phy_dis(ab);
>  		ab8500_usb_peri_phy_dis(ab);
> -		ab->otg.state = USB_PHY_STATE_B_IDLE;
> -		ab->otg.default_a = false;
> +		ab->phy.state = USB_PHY_STATE_B_IDLE;
> +		ab->phy.otg->default_a = false;

ideally users wouldn't access 'otg' directly. You should have a bunch of
reader/setter helpers which are optimized out when OTG isn't enabled.
Then we could:

usb_otg_default_a(&ab->phy, false);

or something similar. Ditto for all others. Can, of course, be done on a
later patch.

> @@ -488,19 +487,27 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
>  	if (!ab)
>  		return -ENOMEM;
>  
> +	ab->phy.otg = kzalloc(sizeof *ab->phy.otg, GFP_KERNEL);

I don't see the point of requiring users to allocate the otg structure.
What's the rationale ?

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux