usb: dwc3-msm: remove use of global context variable (ADC)

Remove usage of the global context variable by retrieving the
instance from the dev pointer passed to the sysfs functions. This
will allow the driver to eventually support multiple instances.

Change-Id: If08ddcab8cdb4753c04add1f2b9efa683bcab474
Signed-off-by: Jack Pham <jackp@codeaurora.org>
diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c
index 2487e3f..c5d0585 100644
--- a/drivers/usb/dwc3/dwc3-msm.c
+++ b/drivers/usb/dwc3/dwc3-msm.c
@@ -2367,7 +2367,12 @@
 static ssize_t adc_enable_show(struct device *dev,
 			       struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%s\n", context->id_adc_detect ?
+	struct dwc3_msm *mdwc = dev_get_drvdata(dev);
+
+	if (!mdwc)
+		return -EINVAL;
+
+	return snprintf(buf, PAGE_SIZE, "%s\n", mdwc->id_adc_detect ?
 						"enabled" : "disabled");
 }
 
@@ -2375,13 +2380,18 @@
 		struct device_attribute *attr, const char
 		*buf, size_t size)
 {
+	struct dwc3_msm *mdwc = dev_get_drvdata(dev);
+
+	if (!mdwc)
+		return -EINVAL;
+
 	if (!strnicmp(buf, "enable", 6)) {
-		if (!context->id_adc_detect)
-			dwc3_init_adc_work(&context->init_adc_work.work);
+		if (!mdwc->id_adc_detect)
+			dwc3_init_adc_work(&mdwc->init_adc_work.work);
 		return size;
 	} else if (!strnicmp(buf, "disable", 7)) {
 		qpnp_adc_tm_usbid_end();
-		context->id_adc_detect = false;
+		mdwc->id_adc_detect = false;
 		return size;
 	}