RE: [RFC PATCH 16/17] usb: otg: Remove OTG specific members from usb_transceiver

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

 



 

> -----Original Message-----
> From: Heikki Krogerus [mailto:heikki.krogerus@xxxxxxxxxxxxxxx]
> Sent: Tuesday, August 16, 2011 6:10 PM
> To: Greg KH; Felipe Balbi
> Cc: linux-usb@xxxxxxxxxxxxxxx; Pavankumar Kondeti; Li Yang-R58472; Eric
> Miao; Alan Stern; Sascha Hauer; Philipp Zabel; Chen Peter-B29397; Lin
> Tony-B19295
> Subject: [RFC PATCH 16/17] usb: otg: Remove OTG specific members from
> usb_transceiver
> 
> All the drivers are now converted to use struct otg, so
> removing the OTG specific memebers from struct
> usb_transceiver.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> ---
>  include/linux/usb/otg.h |   51 ++++-------------------------------------
> -----
>  1 files changed, 5 insertions(+), 46 deletions(-)
> 
> diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> index 309f45c..11c961f 100644
> --- a/include/linux/usb/otg.h
> +++ b/include/linux/usb/otg.h
> @@ -89,15 +89,10 @@ struct usb_transceiver {
>  	const char		*label;
>  	unsigned int		 flags;
> 
> -	u8			default_a;
> -	enum usb_otg_state	state;
>  	enum usb_xceiv_events	last_event;
> 
>  	struct otg		*otg;
> 
> -	struct usb_bus		*host;
> -	struct usb_gadget	*gadget;
> -
>  	struct usb_phy_io_ops	*io_ops;
>  	void __iomem		*io_priv;
> 
> @@ -112,32 +107,14 @@ struct usb_transceiver {
>  	int	(*init)(struct usb_transceiver *x);
>  	void	(*shutdown)(struct usb_transceiver *x);
> 
> -	/* bind/unbind the host controller */
> -	int	(*set_host)(struct usb_transceiver *x,
> -				struct usb_bus *host);
> -
> -	/* bind/unbind the peripheral controller */
> -	int	(*set_peripheral)(struct usb_transceiver *x,
> -				struct usb_gadget *gadget);
> -
>  	/* effective for B devices, ignored for A-peripheral */
>  	int	(*set_power)(struct usb_transceiver *x,
>  				unsigned mA);
> 
> -	/* effective for A-peripheral, ignored for B devices */
> -	int	(*set_vbus)(struct usb_transceiver *x,
> -				bool enabled);
> -
>  	/* for non-OTG B devices: set transceiver into suspend mode */
>  	int	(*set_suspend)(struct usb_transceiver *x,
>  				int suspend);
> 
> -	/* for B devices only:  start session with A-Host */
> -	int	(*start_srp)(struct usb_transceiver *x);
> -
> -	/* start or continue HNP role switch */
> -	int	(*start_hnp)(struct usb_transceiver *x);
> -
>  };
> 
Great jobs, Heikki. Is it ok to add a set_wakeup interface to struct usb_transceiver,
like:  
enum usb_mode {
	USB_DEVICE_MODE,
	USB_HOST_MODE,
};

int	(*set_wakeup)(struct usb_transceiver *x,
  				enum usb_mode um, int wakeup);

 
> @@ -221,7 +198,7 @@ otg_start_hnp(struct usb_transceiver *x)
>  	if (x->otg && x->otg->start_hnp)
>  		return x->otg->start_hnp(x->otg);
> 
> -	return x->start_hnp(x);
> +	return -ENOTSUPP;
>  }
> 
>  /* Context: can sleep */
> @@ -231,7 +208,7 @@ otg_set_vbus(struct usb_transceiver *x, bool enabled)
>  	if (x->otg && x->otg->set_vbus)
>  		return x->otg->set_vbus(x->otg, enabled);
> 
> -	return x->set_vbus(x, enabled);
> +	return -ENOTSUPP;
>  }
> 
>  /* for HCDs */
> @@ -241,7 +218,7 @@ otg_set_host(struct usb_transceiver *x, struct
> usb_bus *host)
>  	if (x->otg && x->otg->set_host)
>  		return x->otg->set_host(x->otg, host);
> 
> -	return x->set_host(x, host);
> +	return -ENOTSUPP;
>  }
> 
>  /* for usb peripheral controller drivers */
> @@ -253,7 +230,7 @@ otg_set_peripheral(struct usb_transceiver *x, struct
> usb_gadget *periph)
>  	if (x->otg && x->otg->set_peripheral)
>  		return x->otg->set_peripheral(x->otg, periph);
> 
> -	return x->set_peripheral(x, periph);
> +	return -ENOTSUPP;
>  }
> 
>  static inline int
> @@ -280,7 +257,7 @@ otg_start_srp(struct usb_transceiver *x)
>  	if (x->otg && x->otg->start_srp)
>  		return x->otg->start_srp(x->otg);
> 
> -	return x->start_srp(x);
> +	return -ENOTSUPP;
>  }
> 
>  /* notifiers */
> @@ -299,22 +276,4 @@ usb_unregister_notifier(struct usb_transceiver *x,
> struct notifier_block *nb)
>  /* for OTG controller drivers (and maybe other stuff) */
>  extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
> 
> -/* Temporary aliases for transceiver functions */
> -#define otg_set_transceiver(x) usb_set_transceiver(x)
> -#define otg_get_transceiver() usb_get_transceiver()
> -#define otg_put_transceiver(x) usb_put_transceiver(x)
> -
> -#define otg_io_read(x, a) usb_transceiver_io_read(x, a)
> -#define otg_io_write(x, a, b) usb_transceiver_io_write(x, a, b)
> -
> -#define otg_init(x) usb_transceiver_init(x)
> -#define otg_shutdown(x) usb_transceiver_shutdown(x)
> -#define otg_set_power(x, a) usb_transceiver_set_power(x, a)
> -#define otg_set_suspend(x, a) usb_transceiver_set_suspend(x, a)
> -
> -#define otg_register_notifier(x, a) usb_register_notifier(x, a)
> -#define otg_unregister_notifier(x, a) usb_unregiser_notifier(x, a)
> -
> -#define otg_io_access_ops usb_phy_io_ops
> -
>  #endif /* __LINUX_USB_OTG_H */
> --
> 1.7.4.1
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux