RE: [PATCHv2 02/13] usb: dwc2: Moves s3c_hsotg gadget data structure into dwc2_hsotg

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

 



> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of Paul Zimmerman
> Sent: Friday, August 01, 2014 11:49 AM
> 
> > From: dinguyen@xxxxxxxxxx [mailto:dinguyen@xxxxxxxxxx]
> > Sent: Wednesday, July 30, 2014 8:21 AM
> >
> > Adds the gadget data structure and appropriate data structure pointers
> > to the common dwc2_hsotg data structure. This is needed so that the
> > dwc2_hsotg data structure can be used by the hcd and gadget drivers.
> >
> > Signed-off-by: Dinh Nguyen <dinguyen@xxxxxxxxxx>
> > ---
> >  drivers/usb/dwc2/core.h |    6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> > index 3b4bd4c..ee34ee1 100644
> > --- a/drivers/usb/dwc2/core.h
> > +++ b/drivers/usb/dwc2/core.h
> > @@ -604,6 +604,12 @@ struct dwc2_hsotg {
> >  	struct timer_list wkp_timer;
> >  	enum dwc2_lx_state lx_state;
> >
> > +	/* Gadget structures */
> > +	struct s3c_hsotg *s3c_hsotg;
> > +	struct usb_gadget       gadget;
> > +	struct usb_gadget_driver *driver;
> > +	struct s3c_hsotg_ep     *eps;
> > +
> 
> Hi Dinh,
> 
> After looking at this some more, I'm not really happy with including
> a pointer to the s3c_hsotg struct inside the dwc2_hsotg struct. It
> makes the peripheral mode kind of a second class citizen, and requires
> a bunch of double pointer indirections in gadget.c
> (hsotg->s3c_hsotg->foo). Plus, when building for peripheral-only mode,
> there are a lot of unused fields in the dwc2_hsotg struct.
> 
> So how about something like the below instead? This moves all of the
> s3c_hsotg struct fields into the dwc2_hsotg struct, and adds ifdefs
> around the host-only and peripheral-only fields. Doing this should
> make the diff to gadget.c even smaller, since it eliminates the double
> indirections.
> 
> This patch is on top of your series. And I'm only showing the changes
> to core.h.

And here is a patch which actually compiles in all three modes. I am
including the full patch, including the changes to gadget.c, this time.

These changes should really be folded into your series, instead of
being tacked onto the end like this.

I have no way to test this, since I don't have non-PCI hardware that
works in peripheral mode. (After this series goes in, I plan to add
support for that on PCI.)

-- 
Paul

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index ed8d81d..4d551e9 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -155,67 +155,6 @@ struct s3c_hsotg_ep {
 };
 
 /**
- * struct s3c_hsotg - driver state.
- * @dev: The parent device supplied to the probe function
- * @driver: USB gadget driver
- * @phy: The otg phy transceiver structure for phy control.
- * @uphy: The otg phy transceiver structure for old USB phy control.
- * @plat: The platform specific configuration data. This can be removed once
- * all SoCs support usb transceiver.
- * @regs: The memory area mapped for accessing registers.
- * @irq: The IRQ number we are using
- * @supplies: Definition of USB power supplies
- * @phyif: PHY interface width
- * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos.
- * @num_of_eps: Number of available EPs (excluding EP0)
- * @debug_root: root directrory for debugfs.
- * @debug_file: main status file for debugfs.
- * @debug_fifo: FIFO status file for debugfs.
- * @ep0_reply: Request used for ep0 reply.
- * @ep0_buff: Buffer for EP0 reply data, if needed.
- * @ctrl_buff: Buffer for EP0 control requests.
- * @ctrl_req: Request for EP0 control packets.
- * @setup: NAK management for EP0 SETUP
- * @last_rst: Time of last reset
- * @eps: The endpoints being supplied to the gadget framework
- */
-struct s3c_hsotg {
-	struct device            *dev;
-	struct usb_gadget_driver *driver;
-	struct phy               *phy;
-	struct usb_phy           *uphy;
-	struct s3c_hsotg_plat    *plat;
-
-	spinlock_t              lock;
-
-	void __iomem            *regs;
-	int                     irq;
-	struct clk              *clk;
-
-	struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)];
-
-	u32                     phyif;
-	int			fifo_mem;
-	unsigned int            dedicated_fifos:1;
-	unsigned char           num_of_eps;
-	u32			fifo_map;
-
-	struct dentry           *debug_root;
-	struct dentry           *debug_file;
-	struct dentry           *debug_fifo;
-
-	struct usb_request      *ep0_reply;
-	struct usb_request      *ctrl_req;
-	u8                      ep0_buff[8];
-	u8                      ctrl_buff[8];
-
-	struct usb_gadget       gadget;
-	unsigned int            setup;
-	unsigned long           last_rst;
-	struct s3c_hsotg_ep     *eps;
-};
-
-/**
  * struct s3c_hsotg_req - data transfer request
  * @req: The USB gadget request
  * @queue: The list of requests for the endpoint this is queued for.
@@ -229,6 +168,7 @@ struct s3c_hsotg_req {
 	unsigned char           mapped;
 };
 
+#if defined(CONFIG_USB_DWC2_PERIPHERAL) || defined(CONFIG_USB_DWC2_DUAL_ROLE)
 #define call_gadget(_hs, _entry) \
 do { \
 	if ((_hs)->gadget.speed != USB_SPEED_UNKNOWN && \
@@ -238,6 +178,9 @@ do { \
 		spin_lock(&_hs->lock); \
 	} \
 } while (0)
+#else
+#define call_gadget(_hs, _entry)	do {} while (0)
+#endif
 
 struct dwc2_hsotg;
 struct dwc2_host_chan;
@@ -495,15 +438,19 @@ struct dwc2_hw_params {
  * struct dwc2_hsotg - Holds the state of the driver, including the non-periodic
  * and periodic schedules
  *
+ * These are common for both host and peripheral modes:
+ *
  * @dev:                The struct device pointer
- * @regs:		Pointer to controller regs
- * @core_params:        Parameters that define how the core should be configured
+ * @regs:               Pointer to controller regs
  * @hw_params:          Parameters that were autodetected from the
  *                      hardware registers
+ * @core_params:        Parameters that define how the core should be configured
  * @op_state:           The operational State, during transitions (a_host=>
  *                      a_peripheral and b_device=>b_host) this may not match
  *                      the core, but allows the software to determine
  *                      transitions
+ * @lock:               Spinlock that protects all the driver data structures
+ * @priv:               Stores a pointer to the struct usb_hcd
  * @queuing_high_bandwidth: True if multiple packets of a high-bandwidth
  *                      transfer are in process of being queued
  * @srp_success:        Stores status of SRP request in the case of a FS PHY
@@ -513,6 +460,9 @@ struct dwc2_hw_params {
  *                      interrupt
  * @wkp_timer:          Timer object for handling Wakeup Detected interrupt
  * @lx_state:           Lx state of connected device
+ *
+ * These are for host mode:
+ *
  * @flags:              Flags for handling root port state changes
  * @non_periodic_sched_inactive: Inactive QHs in the non-periodic schedule.
  *                      Transfers associated with these QHs are not currently
@@ -581,11 +531,31 @@ struct dwc2_hw_params {
  * @status_buf_dma:     DMA address for status_buf
  * @start_work:         Delayed work for handling host A-cable connection
  * @reset_work:         Delayed work for handling a port reset
- * @lock:               Spinlock that protects all the driver data structures
- * @priv:               Stores a pointer to the struct usb_hcd
  * @otg_port:           OTG port number
  * @frame_list:         Frame list
  * @frame_list_dma:     Frame list DMA address
+ *
+ * These are for peripheral mode:
+ *
+ * @driver:             USB gadget driver
+ * @phy:                The otg phy transceiver structure for phy control.
+ * @uphy:               The otg phy transceiver structure for old USB phy control.
+ * @plat:               The platform specific configuration data. This can be removed once
+ *                      all SoCs support usb transceiver.
+ * @supplies:           Definition of USB power supplies
+ * @phyif:              PHY interface width
+ * @dedicated_fifos:    Set if the hardware has dedicated IN-EP fifos.
+ * @num_of_eps:         Number of available EPs (excluding EP0)
+ * @debug_root:         Root directrory for debugfs.
+ * @debug_file:         Main status file for debugfs.
+ * @debug_fifo:         FIFO status file for debugfs.
+ * @ep0_reply:          Request used for ep0 reply.
+ * @ep0_buff:           Buffer for EP0 reply data, if needed.
+ * @ctrl_buff:          Buffer for EP0 control requests.
+ * @ctrl_req:           Request for EP0 control packets.
+ * @setup:              NAK management for EP0 SETUP
+ * @last_rst:           Time of last reset
+ * @eps:                The endpoints being supplied to the gadget framework
  */
 struct dwc2_hsotg {
 	struct device *dev;
@@ -596,6 +566,9 @@ struct dwc2_hsotg {
 	struct dwc2_core_params *core_params;
 	enum usb_otg_state op_state;
 
+	spinlock_t lock;
+	void *priv;
+
 	unsigned int queuing_high_bandwidth:1;
 	unsigned int srp_success:1;
 
@@ -604,12 +577,14 @@ struct dwc2_hsotg {
 	struct timer_list wkp_timer;
 	enum dwc2_lx_state lx_state;
 
-	/* Gadget structures */
-	struct s3c_hsotg *s3c_hsotg;
-	struct usb_gadget gadget;
-	struct usb_gadget_driver *driver;
-	struct s3c_hsotg_ep *eps;
+	/* DWC OTG HW Release versions */
+#define DWC2_CORE_REV_2_71a	0x4f54271a
+#define DWC2_CORE_REV_2_90a	0x4f54290a
+#define DWC2_CORE_REV_2_92a	0x4f54292a
+#define DWC2_CORE_REV_2_94a	0x4f54294a
+#define DWC2_CORE_REV_3_00a	0x4f54300a
 
+#if defined(CONFIG_USB_DWC2_HOST) || defined(CONFIG_USB_DWC2_DUAL_ROLE)
 	union dwc2_hcd_internal_flags {
 		u32 d32;
 		struct {
@@ -656,19 +631,10 @@ struct dwc2_hsotg {
 
 	struct delayed_work start_work;
 	struct delayed_work reset_work;
-	spinlock_t lock;
-	void *priv;
 	u8 otg_port;
 	u32 *frame_list;
 	dma_addr_t frame_list_dma;
 
-	/* DWC OTG HW Release versions */
-#define DWC2_CORE_REV_2_71a	0x4f54271a
-#define DWC2_CORE_REV_2_90a	0x4f54290a
-#define DWC2_CORE_REV_2_92a	0x4f54292a
-#define DWC2_CORE_REV_2_94a	0x4f54294a
-#define DWC2_CORE_REV_3_00a	0x4f54300a
-
 #ifdef DEBUG
 	u32 frrem_samples;
 	u64 frrem_accum;
@@ -687,6 +653,39 @@ struct dwc2_hsotg {
 	u32 hfnum_other_samples_b;
 	u64 hfnum_other_frrem_accum_b;
 #endif
+#endif
+
+#if defined(CONFIG_USB_DWC2_PERIPHERAL) || defined(CONFIG_USB_DWC2_DUAL_ROLE)
+	/* Gadget structures */
+	struct usb_gadget_driver *driver;
+	struct phy *phy;
+	struct usb_phy *uphy;
+	struct s3c_hsotg_plat *plat;
+
+	struct clk *clk;
+
+	struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)];
+
+	u32 phyif;
+	int fifo_mem;
+	unsigned int dedicated_fifos:1;
+	unsigned char num_of_eps;
+	u32 fifo_map;
+
+	struct dentry *debug_root;
+	struct dentry *debug_file;
+	struct dentry *debug_fifo;
+
+	struct usb_request *ep0_reply;
+	struct usb_request *ctrl_req;
+	u8 ep0_buff[8];
+	u8 ctrl_buff[8];
+
+	struct usb_gadget gadget;
+	unsigned int setup;
+	unsigned long last_rst;
+	struct s3c_hsotg_ep *eps;
+#endif
 };
 
 /* Reasons for halting a host channel */
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 281b33a..36db7b6 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -88,7 +88,7 @@ static void s3c_hsotg_dump(struct dwc2_hsotg *hsotg);
  *
  * Until this issue is sorted out, we always return 'false'.
  */
-static inline bool using_dma(struct s3c_hsotg *hsotg)
+static inline bool using_dma(struct dwc2_hsotg *hsotg)
 {
 	return false;	/* support is not complete */
 }
@@ -199,7 +199,7 @@ static void s3c_hsotg_init_fifo(struct dwc2_hsotg *hsotg)
 	for (ep = 1; ep <= 4; ep++) {
 		val = addr;
 		val |= size << FIFOSIZE_DEPTH_SHIFT;
-		WARN_ONCE(addr + size > hsotg->s3c_hsotg->fifo_mem,
+		WARN_ONCE(addr + size > hsotg->fifo_mem,
 			  "insufficient fifo memory");
 		addr += size;
 
@@ -210,7 +210,7 @@ static void s3c_hsotg_init_fifo(struct dwc2_hsotg *hsotg)
 	for (ep = 5; ep <= 8; ep++) {
 		val = addr;
 		val |= size << FIFOSIZE_DEPTH_SHIFT;
-		WARN_ONCE(addr + size > hsotg->s3c_hsotg->fifo_mem,
+		WARN_ONCE(addr + size > hsotg->fifo_mem,
 			  "insufficient fifo memory");
 		addr += size;
 
@@ -334,7 +334,7 @@ static int s3c_hsotg_write_fifo(struct dwc2_hsotg *hsotg,
 	if (to_write == 0)
 		return 0;
 
-	if (periodic && !hsotg->s3c_hsotg->dedicated_fifos) {
+	if (periodic && !hsotg->dedicated_fifos) {
 		u32 epsize = readl(hsotg->regs + DIEPTSIZ(hs_ep->index));
 		int size_left;
 		int size_done;
@@ -375,7 +375,7 @@ static int s3c_hsotg_write_fifo(struct dwc2_hsotg *hsotg,
 			s3c_hsotg_en_gsint(hsotg, GINTSTS_PTXFEMP);
 			return -ENOSPC;
 		}
-	} else if (hsotg->s3c_hsotg->dedicated_fifos && hs_ep->index != 0) {
+	} else if (hsotg->dedicated_fifos && hs_ep->index != 0) {
 		can_write = readl(hsotg->regs + DTXFSTS(hs_ep->index));
 
 		can_write &= 0xffff;
@@ -416,7 +416,7 @@ static int s3c_hsotg_write_fifo(struct dwc2_hsotg *hsotg,
 		to_write = max_transfer;
 
 		/* it's needed only when we do not use dedicated fifos */
-		if (!hsotg->s3c_hsotg->dedicated_fifos)
+		if (!hsotg->dedicated_fifos)
 			s3c_hsotg_en_gsint(hsotg,
 					   periodic ? GINTSTS_PTXFEMP :
 					   GINTSTS_NPTXFEMP);
@@ -445,7 +445,7 @@ static int s3c_hsotg_write_fifo(struct dwc2_hsotg *hsotg,
 		 */
 
 		/* it's needed only when we do not use dedicated fifos */
-		if (!hsotg->s3c_hsotg->dedicated_fifos)
+		if (!hsotg->dedicated_fifos)
 			s3c_hsotg_en_gsint(hsotg,
 					   periodic ? GINTSTS_PTXFEMP :
 					   GINTSTS_NPTXFEMP);
@@ -627,7 +627,7 @@ static void s3c_hsotg_start_req(struct dwc2_hsotg *hsotg,
 	/* write size / packets */
 	writel(epsize, hsotg->regs + epsize_reg);
 
-	if (using_dma(hsotg->s3c_hsotg) && !continuing) {
+	if (using_dma(hsotg) && !continuing) {
 		unsigned int dma_reg;
 
 		/*
@@ -645,11 +645,11 @@ static void s3c_hsotg_start_req(struct dwc2_hsotg *hsotg,
 	ctrl |= DXEPCTL_EPENA;	/* ensure ep enabled */
 	ctrl |= DXEPCTL_USBACTEP;
 
-	dev_dbg(hsotg->dev, "setup req:%d\n", hsotg->s3c_hsotg->setup);
+	dev_dbg(hsotg->dev, "setup req:%d\n", hsotg->setup);
 
 	/* For Setup request do not clear NAK */
-	if (hsotg->s3c_hsotg->setup && index == 0)
-		hsotg->s3c_hsotg->setup = 0;
+	if (hsotg->setup && index == 0)
+		hsotg->setup = 0;
 	else
 		ctrl |= DXEPCTL_CNAK;	/* clear NAK set by core */
 
@@ -665,7 +665,7 @@ static void s3c_hsotg_start_req(struct dwc2_hsotg *hsotg,
 	hs_ep->size_loaded = length;
 	hs_ep->last_load = ureq->actual;
 
-	if (dir_in && !using_dma(hsotg->s3c_hsotg)) {
+	if (dir_in && !using_dma(hsotg)) {
 		/* set these anyway, we may need them for non-periodic in */
 		hs_ep->fifo_load = 0;
 
@@ -752,7 +752,7 @@ static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
 	req->status = -EINPROGRESS;
 
 	/* if we're using DMA, sync the buffers as necessary */
-	if (using_dma(hs->s3c_hsotg)) {
+	if (using_dma(hs)) {
 		int ret = s3c_hsotg_map_dma(hs, hs_ep, req);
 		if (ret)
 			return ret;
@@ -827,7 +827,7 @@ static struct s3c_hsotg_ep *ep_from_windex(struct dwc2_hsotg *hsotg,
 	if (windex >= 0x100)
 		return NULL;
 
-	if (idx > hsotg->s3c_hsotg->num_of_eps)
+	if (idx > hsotg->num_of_eps)
 		return NULL;
 
 	if (idx && ep->dir_in != dir)
@@ -857,13 +857,13 @@ static int s3c_hsotg_send_reply(struct dwc2_hsotg *hsotg,
 	dev_dbg(hsotg->dev, "%s: buff %p, len %d\n", __func__, buff, length);
 
 	req = s3c_hsotg_ep_alloc_request(&ep->ep, GFP_ATOMIC);
-	hsotg->s3c_hsotg->ep0_reply = req;
+	hsotg->ep0_reply = req;
 	if (!req) {
 		dev_warn(hsotg->dev, "%s: cannot alloc req\n", __func__);
 		return -ENOMEM;
 	}
 
-	req->buf = hsotg->s3c_hsotg->ep0_buff;
+	req->buf = hsotg->ep0_buff;
 	req->length = length;
 	req->zero = 1; /* always do zero-length final transfer */
 	req->complete = s3c_hsotg_complete_oursetup;
@@ -1188,7 +1188,7 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep,
  */
 static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg *hsotg)
 {
-	struct usb_request *req = hsotg->s3c_hsotg->ctrl_req;
+	struct usb_request *req = hsotg->ctrl_req;
 	struct s3c_hsotg_req *hs_req = our_req(req);
 	int ret;
 
@@ -1196,7 +1196,7 @@ static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg *hsotg)
 
 	req->zero = 0;
 	req->length = 8;
-	req->buf = hsotg->s3c_hsotg->ctrl_buff;
+	req->buf = hsotg->ctrl_buff;
 	req->complete = s3c_hsotg_complete_setup;
 
 	if (!list_empty(&hs_req->queue)) {
@@ -1255,7 +1255,7 @@ static void s3c_hsotg_complete_request(struct dwc2_hsotg *hsotg,
 	hs_ep->req = NULL;
 	list_del_init(&hs_req->queue);
 
-	if (using_dma(hsotg->s3c_hsotg))
+	if (using_dma(hsotg))
 		s3c_hsotg_unmap_dma(hsotg, hs_ep, hs_req);
 
 	/*
@@ -1416,7 +1416,7 @@ static void s3c_hsotg_handle_outdone(struct dwc2_hsotg *hsotg,
 		return;
 	}
 
-	if (using_dma(hsotg->s3c_hsotg)) {
+	if (using_dma(hsotg)) {
 		unsigned size_done;
 
 		/*
@@ -1443,7 +1443,7 @@ static void s3c_hsotg_handle_outdone(struct dwc2_hsotg *hsotg,
 		 * After was_setup = 1 =>
 		 * set CNAK for non Setup requests
 		 */
-		hsotg->s3c_hsotg->setup = was_setup ? 0 : 1;
+		hsotg->setup = was_setup ? 0 : 1;
 	}
 
 	if (req->actual < req->length && req->short_not_ok) {
@@ -1506,7 +1506,7 @@ static void s3c_hsotg_handle_rx(struct dwc2_hsotg *hsotg)
 	u32 grxstsr = readl(hsotg->regs + GRXSTSP);
 	u32 epnum, status, size;
 
-	WARN_ON(using_dma(hsotg->s3c_hsotg));
+	WARN_ON(using_dma(hsotg));
 
 	epnum = grxstsr & GRXSTS_EPNUM_MASK;
 	status = grxstsr & GRXSTS_PKTSTS_MASK;
@@ -1527,7 +1527,7 @@ static void s3c_hsotg_handle_rx(struct dwc2_hsotg *hsotg)
 		dev_dbg(hsotg->dev, "OutDone (Frame=0x%08x)\n",
 			s3c_hsotg_read_frameno(hsotg));
 
-		if (!using_dma(hsotg->s3c_hsotg))
+		if (!using_dma(hsotg))
 			s3c_hsotg_handle_outdone(hsotg, epnum, false);
 		break;
 
@@ -1836,7 +1836,7 @@ static void s3c_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx,
 
 			if (idx == 0 && !hs_ep->req)
 				s3c_hsotg_enqueue_setup(hsotg);
-		} else if (using_dma(hsotg->s3c_hsotg)) {
+		} else if (using_dma(hsotg)) {
 			/*
 			 * We're using DMA, we need to fire an OutDone here
 			 * as we ignore the RXFIFO.
@@ -1870,7 +1870,7 @@ static void s3c_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx,
 	if (ints & DXEPINT_SETUP) {  /* Setup or Timeout */
 		dev_dbg(hsotg->dev, "%s: Setup/Timeout\n",  __func__);
 
-		if (using_dma(hsotg->s3c_hsotg) && idx == 0) {
+		if (using_dma(hsotg) && idx == 0) {
 			/*
 			 * this is the notification we've received a
 			 * setup packet. In non-DMA mode we'd get this
@@ -1902,11 +1902,11 @@ static void s3c_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx,
 		}
 
 		/* FIFO has space or is empty (see GAHBCFG) */
-		if (hsotg->s3c_hsotg->dedicated_fifos &&
+		if (hsotg->dedicated_fifos &&
 		    ints & DIEPMSK_TXFIFOEMPTY) {
 			dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n",
 				__func__, idx);
-			if (!using_dma(hsotg->s3c_hsotg))
+			if (!using_dma(hsotg))
 				s3c_hsotg_trytx(hsotg, hs_ep);
 		}
 	}
@@ -1973,7 +1973,7 @@ static void s3c_hsotg_irq_enumdone(struct dwc2_hsotg *hsotg)
 	if (ep0_mps) {
 		int i;
 		s3c_hsotg_set_ep_maxpacket(hsotg, 0, ep0_mps);
-		for (i = 1; i < hsotg->s3c_hsotg->num_of_eps; i++)
+		for (i = 1; i < hsotg->num_of_eps; i++)
 			s3c_hsotg_set_ep_maxpacket(hsotg, i, ep_mps);
 	}
 
@@ -2015,7 +2015,7 @@ static void kill_all_requests(struct dwc2_hsotg *hsotg,
 		s3c_hsotg_complete_request(hsotg, ep, req,
 					   result);
 	}
-	if (!hsotg->s3c_hsotg->dedicated_fifos)
+	if (!hsotg->dedicated_fifos)
 		return;
 	size = (readl(hsotg->regs + DTXFSTS(ep->index)) & 0xffff) * 4;
 	if (size < ep->fifo_size)
@@ -2034,7 +2034,7 @@ static void s3c_hsotg_disconnect(struct dwc2_hsotg *hsotg)
 {
 	unsigned ep;
 
-	for (ep = 0; ep < hsotg->s3c_hsotg->num_of_eps; ep++)
+	for (ep = 0; ep < hsotg->num_of_eps; ep++)
 		kill_all_requests(hsotg, &hsotg->eps[ep], -ESHUTDOWN, true);
 
 	call_gadget(hsotg, disconnect);
@@ -2052,7 +2052,7 @@ static void s3c_hsotg_irq_fifoempty(struct dwc2_hsotg *hsotg, bool periodic)
 
 	/* look through for any more data to transmit */
 
-	for (epno = 0; epno < hsotg->s3c_hsotg->num_of_eps; epno++) {
+	for (epno = 0; epno < hsotg->num_of_eps; epno++) {
 		ep = &hsotg->eps[epno];
 
 		if (!ep->dir_in)
@@ -2137,7 +2137,7 @@ void s3c_hsotg_core_init(struct dwc2_hsotg *hsotg)
 	 */
 
 	/* set the PLL on, remove the HNP/SRP and set the PHY */
-	writel(hsotg->s3c_hsotg->phyif | GUSBCFG_TOUTCAL(7) |
+	writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
 	       (0x5 << 10), hsotg->regs + GUSBCFG);
 
 	s3c_hsotg_init_fifo(hsotg);
@@ -2159,12 +2159,12 @@ void s3c_hsotg_core_init(struct dwc2_hsotg *hsotg)
 		GINTSTS_USBSUSP | GINTSTS_WKUPINT,
 		hsotg->regs + GINTMSK);
 
-	if (using_dma(hsotg->s3c_hsotg))
+	if (using_dma(hsotg))
 		writel(GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN |
 		       GAHBCFG_HBSTLEN_INCR4,
 		       hsotg->regs + GAHBCFG);
 	else
-		writel(((hsotg->s3c_hsotg->dedicated_fifos) ? (GAHBCFG_NP_TXF_EMP_LVL |
+		writel(((hsotg->dedicated_fifos) ? (GAHBCFG_NP_TXF_EMP_LVL |
 						    GAHBCFG_P_TXF_EMP_LVL) : 0) |
 		       GAHBCFG_GLBL_INTR_EN,
 		       hsotg->regs + GAHBCFG);
@@ -2175,7 +2175,7 @@ void s3c_hsotg_core_init(struct dwc2_hsotg *hsotg)
 	 * interrupts.
 	 */
 
-	writel(((hsotg->s3c_hsotg->dedicated_fifos) ? DIEPMSK_TXFIFOEMPTY |
+	writel(((hsotg->dedicated_fifos) ? DIEPMSK_TXFIFOEMPTY |
 		DIEPMSK_INTKNTXFEMPMSK : 0) |
 		DIEPMSK_EPDISBLDMSK | DIEPMSK_XFERCOMPLMSK |
 		DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
@@ -2186,7 +2186,7 @@ void s3c_hsotg_core_init(struct dwc2_hsotg *hsotg)
 	 * don't need XferCompl, we get that from RXFIFO in slave mode. In
 	 * DMA mode we may need this.
 	 */
-	writel((using_dma(hsotg->s3c_hsotg) ? (DIEPMSK_XFERCOMPLMSK |
+	writel((using_dma(hsotg) ? (DIEPMSK_XFERCOMPLMSK |
 				    DIEPMSK_TIMEOUTMSK) : 0) |
 		DOEPMSK_EPDISBLDMSK | DOEPMSK_AHBERRMSK |
 		DOEPMSK_SETUPMSK,
@@ -2206,7 +2206,7 @@ void s3c_hsotg_core_init(struct dwc2_hsotg *hsotg)
 	 * the data. In DMA mode, we get events from the FIFO but also
 	 * things we cannot process, so do not use it.
 	 */
-	if (!using_dma(hsotg->s3c_hsotg))
+	if (!using_dma(hsotg))
 		s3c_hsotg_en_gsint(hsotg, GINTSTS_RXFLVL);
 
 	/* Enable interrupts for EP0 in and out */
@@ -2315,14 +2315,14 @@ irq_retry:
 		writel(GINTSTS_USBRST, hsotg->regs + GINTSTS);
 
 		if (usb_status & GOTGCTL_BSESVLD) {
-			if (time_after(jiffies, hsotg->s3c_hsotg->last_rst +
+			if (time_after(jiffies, hsotg->last_rst +
 				       msecs_to_jiffies(200))) {
 
 				kill_all_requests(hsotg, &hsotg->eps[0],
 							  -ECONNRESET, true);
 
 				s3c_hsotg_core_init(hsotg);
-				hsotg->s3c_hsotg->last_rst = jiffies;
+				hsotg->last_rst = jiffies;
 			}
 		}
 	}
@@ -2506,16 +2506,16 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
 	 * if the hardware has dedicated fifos, we must give each IN EP
 	 * a unique tx-fifo even if it is non-periodic.
 	 */
-	if (dir_in && hsotg->s3c_hsotg->dedicated_fifos) {
+	if (dir_in && hsotg->dedicated_fifos) {
 		size = hs_ep->ep.maxpacket*hs_ep->mc;
 		for (i = 1; i <= 8; ++i) {
-			if (hsotg->s3c_hsotg->fifo_map & (1<<i))
+			if (hsotg->fifo_map & (1<<i))
 				continue;
 			val = readl(hsotg->regs + DPTXFSIZN(i));
 			val = (val >> FIFOSIZE_DEPTH_SHIFT)*4;
 			if (val < size)
 				continue;
-			hsotg->s3c_hsotg->fifo_map |= 1<<i;
+			hsotg->fifo_map |= 1<<i;
 
 			epctrl |= DXEPCTL_TXFNUM(i);
 			hs_ep->fifo_index = i;
@@ -2571,7 +2571,7 @@ static int s3c_hsotg_ep_disable(struct usb_ep *ep)
 	/* terminate all requests with shutdown */
 	kill_all_requests(hsotg, hs_ep, -ESHUTDOWN, false);
 
-	hsotg->s3c_hsotg->fifo_map &= ~(1<<hs_ep->fifo_index);
+	hsotg->fifo_map &= ~(1<<hs_ep->fifo_index);
 	hs_ep->fifo_index = 0;
 	hs_ep->fifo_size = 0;
 
@@ -2741,13 +2741,13 @@ static void s3c_hsotg_phy_enable(struct dwc2_hsotg *hsotg)
 
 	dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev);
 
-	if (hsotg->s3c_hsotg->uphy)
-		usb_phy_init(hsotg->s3c_hsotg->uphy);
-	else if (hsotg->s3c_hsotg->plat && hsotg->s3c_hsotg->plat->phy_init)
-		hsotg->s3c_hsotg->plat->phy_init(pdev, hsotg->s3c_hsotg->plat->phy_type);
+	if (hsotg->uphy)
+		usb_phy_init(hsotg->uphy);
+	else if (hsotg->plat && hsotg->plat->phy_init)
+		hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
 	else {
-		phy_init(hsotg->s3c_hsotg->phy);
-		phy_power_on(hsotg->s3c_hsotg->phy);
+		phy_init(hsotg->phy);
+		phy_power_on(hsotg->phy);
 	}
 }
 
@@ -2762,13 +2762,13 @@ static void s3c_hsotg_phy_disable(struct dwc2_hsotg *hsotg)
 {
 	struct platform_device *pdev = to_platform_device(hsotg->dev);
 
-	if (hsotg->s3c_hsotg->uphy)
-		usb_phy_shutdown(hsotg->s3c_hsotg->uphy);
-	else if (hsotg->s3c_hsotg->plat && hsotg->s3c_hsotg->plat->phy_exit)
-		hsotg->s3c_hsotg->plat->phy_exit(pdev, hsotg->s3c_hsotg->plat->phy_type);
+	if (hsotg->uphy)
+		usb_phy_shutdown(hsotg->uphy);
+	else if (hsotg->plat && hsotg->plat->phy_exit)
+		hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type);
 	else {
-		phy_power_off(hsotg->s3c_hsotg->phy);
-		phy_exit(hsotg->s3c_hsotg->phy);
+		phy_power_off(hsotg->phy);
+		phy_exit(hsotg->phy);
 	}
 }
 
@@ -2811,7 +2811,7 @@ static void s3c_hsotg_init(struct dwc2_hsotg *hsotg)
 	writel(GUSBCFG_PHYIF16 | GUSBCFG_TOUTCAL(7) | (0x5 << 10),
 	       hsotg->regs + GUSBCFG);
 
-	writel(using_dma(hsotg->s3c_hsotg) ? GAHBCFG_DMA_EN : 0x0,
+	writel(using_dma(hsotg) ? GAHBCFG_DMA_EN : 0x0,
 	       hsotg->regs + GAHBCFG);
 }
 
@@ -2854,17 +2854,17 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
 	hsotg->gadget.dev.of_node = hsotg->dev->of_node;
 	hsotg->gadget.speed = USB_SPEED_UNKNOWN;
 
-	if (!IS_ERR(hsotg->s3c_hsotg->clk))
-		clk_enable(hsotg->s3c_hsotg->clk);
+	if (!IS_ERR(hsotg->clk))
+		clk_enable(hsotg->clk);
 
-	ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->s3c_hsotg->supplies),
-				    hsotg->s3c_hsotg->supplies);
+	ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies),
+				    hsotg->supplies);
 	if (ret) {
 		dev_err(hsotg->dev, "failed to enable supplies: %d\n", ret);
 		goto err;
 	}
 
-	hsotg->s3c_hsotg->last_rst = jiffies;
+	hsotg->last_rst = jiffies;
 	dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);
 	return 0;
 
@@ -2891,7 +2891,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
 		return -ENODEV;
 
 	/* all endpoints should be shutdown */
-	for (ep = 1; ep < hsotg->s3c_hsotg->num_of_eps; ep++)
+	for (ep = 1; ep < hsotg->num_of_eps; ep++)
 		s3c_hsotg_ep_disable(&hsotg->eps[ep].ep);
 
 	spin_lock_irqsave(&hsotg->lock, flags);
@@ -2903,11 +2903,11 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
 
 	spin_unlock_irqrestore(&hsotg->lock, flags);
 
-	regulator_bulk_disable(ARRAY_SIZE(hsotg->s3c_hsotg->supplies),
-				hsotg->s3c_hsotg->supplies);
+	regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies),
+				hsotg->supplies);
 
-	if (!IS_ERR(hsotg->s3c_hsotg->clk))
-		clk_disable(hsotg->s3c_hsotg->clk);
+	if (!IS_ERR(hsotg->clk))
+		clk_disable(hsotg->clk);
 
 	return 0;
 }
@@ -2940,12 +2940,12 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on)
 	spin_lock_irqsave(&hsotg->lock, flags);
 	if (is_on) {
 		s3c_hsotg_phy_enable(hsotg);
-		if (!IS_ERR(hsotg->s3c_hsotg->clk))
-			clk_enable(hsotg->s3c_hsotg->clk);
+		if (!IS_ERR(hsotg->clk))
+			clk_enable(hsotg->clk);
 		s3c_hsotg_core_init(hsotg);
 	} else {
-		if (!IS_ERR(hsotg->s3c_hsotg->clk))
-			clk_disable(hsotg->s3c_hsotg->clk);
+		if (!IS_ERR(hsotg->clk))
+			clk_disable(hsotg->clk);
 		s3c_hsotg_phy_disable(hsotg);
 	}
 
@@ -3008,7 +3008,7 @@ static void s3c_hsotg_initep(struct dwc2_hsotg *hsotg,
 	 * to be something valid.
 	 */
 
-	if (using_dma(hsotg->s3c_hsotg)) {
+	if (using_dma(hsotg)) {
 		u32 next = DXEPCTL_NEXTEP((epnum + 1) % 15);
 		writel(next, hsotg->regs + DIEPCTL(epnum));
 		writel(next, hsotg->regs + DOEPCTL(epnum));
@@ -3027,18 +3027,18 @@ static void s3c_hsotg_hw_cfg(struct dwc2_hsotg *hsotg)
 	/* check hardware configuration */
 
 	cfg2 = readl(hsotg->regs + 0x48);
-	hsotg->s3c_hsotg->num_of_eps = (cfg2 >> 10) & 0xF;
+	hsotg->num_of_eps = (cfg2 >> 10) & 0xF;
 
 	cfg3 = readl(hsotg->regs + 0x4C);
-	hsotg->s3c_hsotg->fifo_mem = (cfg3 >> 16);
+	hsotg->fifo_mem = (cfg3 >> 16);
 
 	cfg4 = readl(hsotg->regs + 0x50);
-	hsotg->s3c_hsotg->dedicated_fifos = (cfg4 >> 25) & 1;
+	hsotg->dedicated_fifos = (cfg4 >> 25) & 1;
 
 	dev_info(hsotg->dev, "EPs: %d, %s fifos, %d entries in SPRAM\n",
-		 hsotg->s3c_hsotg->num_of_eps,
-		 hsotg->s3c_hsotg->dedicated_fifos ? "dedicated" : "shared",
-		 hsotg->s3c_hsotg->fifo_mem);
+		 hsotg->num_of_eps,
+		 hsotg->dedicated_fifos ? "dedicated" : "shared",
+		 hsotg->fifo_mem);
 }
 
 /**
@@ -3313,7 +3313,7 @@ static void s3c_hsotg_create_debug(struct dwc2_hsotg *hsotg)
 	unsigned epidx;
 
 	root = debugfs_create_dir(dev_name(hsotg->dev), NULL);
-	hsotg->s3c_hsotg->debug_root = root;
+	hsotg->debug_root = root;
 	if (IS_ERR(root)) {
 		dev_err(hsotg->dev, "cannot create debug root\n");
 		return;
@@ -3321,21 +3321,21 @@ static void s3c_hsotg_create_debug(struct dwc2_hsotg *hsotg)
 
 	/* create general state file */
 
-	hsotg->s3c_hsotg->debug_file = debugfs_create_file("state", 0444, root,
+	hsotg->debug_file = debugfs_create_file("state", 0444, root,
 						hsotg, &state_fops);
 
-	if (IS_ERR(hsotg->s3c_hsotg->debug_file))
+	if (IS_ERR(hsotg->debug_file))
 		dev_err(hsotg->dev, "%s: failed to create state\n", __func__);
 
-	hsotg->s3c_hsotg->debug_fifo = debugfs_create_file("fifo", 0444, root,
+	hsotg->debug_fifo = debugfs_create_file("fifo", 0444, root,
 						hsotg, &fifo_fops);
 
-	if (IS_ERR(hsotg->s3c_hsotg->debug_fifo))
+	if (IS_ERR(hsotg->debug_fifo))
 		dev_err(hsotg->dev, "%s: failed to create fifo\n", __func__);
 
 	/* create one file for each endpoint */
 
-	for (epidx = 0; epidx < hsotg->s3c_hsotg->num_of_eps; epidx++) {
+	for (epidx = 0; epidx < hsotg->num_of_eps; epidx++) {
 		struct s3c_hsotg_ep *ep = &hsotg->eps[epidx];
 
 		ep->debugfs = debugfs_create_file(ep->name, 0444,
@@ -3357,14 +3357,14 @@ static void s3c_hsotg_delete_debug(struct dwc2_hsotg *hsotg)
 {
 	unsigned epidx;
 
-	for (epidx = 0; epidx < hsotg->s3c_hsotg->num_of_eps; epidx++) {
+	for (epidx = 0; epidx < hsotg->num_of_eps; epidx++) {
 		struct s3c_hsotg_ep *ep = &hsotg->eps[epidx];
 		debugfs_remove(ep->debugfs);
 	}
 
-	debugfs_remove(hsotg->s3c_hsotg->debug_file);
-	debugfs_remove(hsotg->s3c_hsotg->debug_fifo);
-	debugfs_remove(hsotg->s3c_hsotg->debug_root);
+	debugfs_remove(hsotg->debug_file);
+	debugfs_remove(hsotg->debug_fifo);
+	debugfs_remove(hsotg->debug_root);
 }
 
 /**
@@ -3375,23 +3375,17 @@ static void s3c_hsotg_delete_debug(struct dwc2_hsotg *hsotg)
 
 int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
 {
-	struct s3c_hsotg_plat *plat = hsotg->dev->platform_data;
+	struct device *dev = hsotg->dev;
+	struct s3c_hsotg_plat *plat = dev->platform_data;
 	struct phy *phy;
 	struct usb_phy *uphy;
-	struct device *dev = hsotg->dev;
 	struct s3c_hsotg_ep *eps;
 	int epnum;
 	int ret;
 	int i;
 
-	hsotg->s3c_hsotg = devm_kzalloc(dev, sizeof(struct s3c_hsotg), GFP_KERNEL);
-	if (!hsotg->s3c_hsotg) {
-		dev_err(dev, "cannot get memory\n");
-		return -ENOMEM;
-	}
-
 	/* Set default UTMI width */
-	hsotg->s3c_hsotg->phyif = GUSBCFG_PHYIF16;
+	hsotg->phyif = GUSBCFG_PHYIF16;
 
 	/*
 	 * Attempt to find a generic PHY, then look for an old style
@@ -3408,44 +3402,44 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
 				"no platform data or transceiver defined\n");
 				return -EPROBE_DEFER;
 			}
-			hsotg->s3c_hsotg->plat = plat;
+			hsotg->plat = plat;
 		} else
-			hsotg->s3c_hsotg->uphy = uphy;
+			hsotg->uphy = uphy;
 	} else {
-		hsotg->s3c_hsotg->phy = phy;
+		hsotg->phy = phy;
 		/*
 		 * If using the generic PHY framework, check if the PHY bus
 		 * width is 8-bit and set the phyif appropriately.
 		 */
 		if (phy_get_bus_width(phy) == 8)
-			hsotg->s3c_hsotg->phyif = GUSBCFG_PHYIF8;
+			hsotg->phyif = GUSBCFG_PHYIF8;
 	}
 
-	hsotg->s3c_hsotg->clk = devm_clk_get(dev, "otg");
-	if (IS_ERR(hsotg->s3c_hsotg->clk))
+	hsotg->clk = devm_clk_get(dev, "otg");
+	if (IS_ERR(hsotg->clk))
 		dev_warn(dev, "cannot get otg clock\n");
 
 	hsotg->gadget.max_speed = USB_SPEED_HIGH;
 	hsotg->gadget.ops = &s3c_hsotg_gadget_ops;
 	hsotg->gadget.name = dev_name(dev);
 
-	if (!IS_ERR(hsotg->s3c_hsotg->clk))
-		clk_prepare_enable(hsotg->s3c_hsotg->clk);
+	if (!IS_ERR(hsotg->clk))
+		clk_prepare_enable(hsotg->clk);
 
 	/* regulators */
 
-	for (i = 0; i < ARRAY_SIZE(hsotg->s3c_hsotg->supplies); i++)
-		hsotg->s3c_hsotg->supplies[i].supply = s3c_hsotg_supply_names[i];
+	for (i = 0; i < ARRAY_SIZE(hsotg->supplies); i++)
+		hsotg->supplies[i].supply = s3c_hsotg_supply_names[i];
 
-	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(hsotg->s3c_hsotg->supplies),
-				 hsotg->s3c_hsotg->supplies);
+	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(hsotg->supplies),
+				 hsotg->supplies);
 	if (ret) {
 		dev_err(dev, "failed to request supplies: %d\n", ret);
 		goto err_clk;
 	}
 
-	ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->s3c_hsotg->supplies),
-				    hsotg->s3c_hsotg->supplies);
+	ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies),
+				    hsotg->supplies);
 
 	if (ret) {
 		dev_err(dev, "failed to enable supplies: %d\n", ret);
@@ -3463,23 +3457,23 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
 			dev_name(dev), hsotg);
 	if (ret < 0) {
 		s3c_hsotg_phy_disable(hsotg);
-		if (!IS_ERR(hsotg->s3c_hsotg->clk))
-			clk_disable_unprepare(hsotg->s3c_hsotg->clk);
-		regulator_bulk_disable(ARRAY_SIZE(hsotg->s3c_hsotg->supplies),
-				       hsotg->s3c_hsotg->supplies);
+		if (!IS_ERR(hsotg->clk))
+			clk_disable_unprepare(hsotg->clk);
+		regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies),
+				       hsotg->supplies);
 		dev_err(dev, "cannot claim IRQ\n");
 		goto err_clk;
 	}
 
 	/* hsotg->num_of_eps holds number of EPs other than ep0 */
 
-	if (hsotg->s3c_hsotg->num_of_eps == 0) {
+	if (hsotg->num_of_eps == 0) {
 		dev_err(dev, "wrong number of EPs (zero)\n");
 		ret = -EINVAL;
 		goto err_supplies;
 	}
 
-	eps = kcalloc(hsotg->s3c_hsotg->num_of_eps + 1, sizeof(struct s3c_hsotg_ep),
+	eps = kcalloc(hsotg->num_of_eps + 1, sizeof(struct s3c_hsotg_ep),
 		      GFP_KERNEL);
 	if (!eps) {
 		dev_err(dev, "cannot get memory\n");
@@ -3496,22 +3490,22 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
 
 	/* allocate EP0 request */
 
-	hsotg->s3c_hsotg->ctrl_req = s3c_hsotg_ep_alloc_request(&hsotg->eps[0].ep,
+	hsotg->ctrl_req = s3c_hsotg_ep_alloc_request(&hsotg->eps[0].ep,
 						     GFP_KERNEL);
-	if (!hsotg->s3c_hsotg->ctrl_req) {
+	if (!hsotg->ctrl_req) {
 		dev_err(dev, "failed to allocate ctrl req\n");
 		ret = -ENOMEM;
 		goto err_ep_mem;
 	}
 
 	/* initialise the endpoints now the core has been initialised */
-	for (epnum = 0; epnum < hsotg->s3c_hsotg->num_of_eps; epnum++)
+	for (epnum = 0; epnum < hsotg->num_of_eps; epnum++)
 		s3c_hsotg_initep(hsotg, &hsotg->eps[epnum], epnum);
 
 	/* disable power and clock */
 
-	ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->s3c_hsotg->supplies),
-				    hsotg->s3c_hsotg->supplies);
+	ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies),
+				     hsotg->supplies);
 	if (ret) {
 		dev_err(dev, "failed to disable supplies: %d\n", ret);
 		goto err_ep_mem;
@@ -3534,8 +3528,8 @@ err_ep_mem:
 err_supplies:
 	s3c_hsotg_phy_disable(hsotg);
 err_clk:
-	if (!IS_ERR(hsotg->s3c_hsotg->clk))
-		clk_disable_unprepare(hsotg->s3c_hsotg->clk);
+	if (!IS_ERR(hsotg->clk))
+		clk_disable_unprepare(hsotg->clk);
 
 	return ret;
 }
@@ -3555,8 +3549,8 @@ int s3c_hsotg_remove(struct dwc2_hsotg *hsotg)
 		usb_gadget_unregister_driver(hsotg->driver);
 	}
 
-	if (!IS_ERR(hsotg->s3c_hsotg->clk))
-		clk_disable_unprepare(hsotg->s3c_hsotg->clk);
+	if (!IS_ERR(hsotg->clk))
+		clk_disable_unprepare(hsotg->clk);
 
 	return 0;
 }
@@ -3578,14 +3572,14 @@ int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg)
 
 	if (hsotg->driver) {
 		int ep;
-		for (ep = 0; ep < hsotg->s3c_hsotg->num_of_eps; ep++)
+		for (ep = 0; ep < hsotg->num_of_eps; ep++)
 			s3c_hsotg_ep_disable(&hsotg->eps[ep].ep);
 
-		ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->s3c_hsotg->supplies),
-					     hsotg->s3c_hsotg->supplies);
+		ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies),
+					     hsotg->supplies);
 
-		if (!IS_ERR(hsotg->s3c_hsotg->clk))
-			clk_disable(hsotg->s3c_hsotg->clk);
+		if (!IS_ERR(hsotg->clk))
+			clk_disable(hsotg->clk);
 	}
 
 	return ret;
@@ -3600,14 +3594,14 @@ int s3c_hsotg_resume(struct dwc2_hsotg *hsotg)
 		dev_info(hsotg->dev, "resuming usb gadget %s\n",
 			 hsotg->driver->driver.name);
 
-		if (!IS_ERR(hsotg->s3c_hsotg->clk))
-			clk_enable(hsotg->s3c_hsotg->clk);
-		ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->s3c_hsotg->supplies),
-				      hsotg->s3c_hsotg->supplies);
+		if (!IS_ERR(hsotg->clk))
+			clk_enable(hsotg->clk);
+		ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies),
+					    hsotg->supplies);
 	}
 
 	spin_lock_irqsave(&hsotg->lock, flags);
-	hsotg->s3c_hsotg->last_rst = jiffies;
+	hsotg->last_rst = jiffies;
 	s3c_hsotg_phy_enable(hsotg);
 	s3c_hsotg_core_init(hsotg);
 	spin_unlock_irqrestore(&hsotg->lock, flags);

--
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