Staging: ti-st: cleanup sysfs code

Remove the older way of communicating with user-space
daemon UIM.
The older way involved creating of a new kobj and pid
sysfs file under it, and sending signal using that pid.

Now we communicate via rfkill to user-space UIM.

Background: UIM is the user-space daemon which upon
notification from ldisc driver, opens the tty, sets
default baud and then installs (tiocsetd) the ldisc.

Signed-off-by: Naveen Jain <naveen_jain@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/drivers/staging/ti-st/st_kim.c b/drivers/staging/ti-st/st_kim.c
index 98cbabb..cfba5f8 100644
--- a/drivers/staging/ti-st/st_kim.c
+++ b/drivers/staging/ti-st/st_kim.c
@@ -55,7 +55,6 @@
 		   },
 };
 
-#ifndef LEGACY_RFKILL_SUPPORT
 static ssize_t show_pid(struct device *dev, struct device_attribute
 			*attr, char *buf);
 static ssize_t store_pid(struct device *dev, struct device_attribute
@@ -80,12 +79,11 @@
 static struct attribute_group uim_attr_grp = {
 	.attrs = uim_attrs,
 };
-#else
+
 static int kim_toggle_radio(void*, bool);
 static const struct rfkill_ops kim_rfkill_ops = {
 	.set_block = kim_toggle_radio,
 };
-#endif	/* LEGACY_RFKILL_SUPPORT */
 
 /* strings to be used for rfkill entries and by
  * ST Core to be used for sysfs debug entry
@@ -436,13 +434,11 @@
 	pr_info(" %s", __func__);
 
 	do {
-#ifdef LEGACY_RFKILL_SUPPORT
 		/* TODO: this is only because rfkill sub-system
 		 * doesn't send events to user-space if the state
 		 * isn't changed
 		 */
 		rfkill_set_hw_state(kim_gdata->rfkill[ST_BT], 1);
-#endif
 		/* Configure BT nShutdown to HIGH state */
 		gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_LOW);
 		mdelay(5);	/* FIXME: a proper toggle */
@@ -450,7 +446,7 @@
 		mdelay(100);
 		/* re-initialize the completion */
 		INIT_COMPLETION(kim_gdata->ldisc_installed);
-#ifndef LEGACY_RFKILL_SUPPORT
+#if 0 /* older way of signalling user-space UIM */
 		/* send signal to UIM */
 		err = kill_pid(find_get_pid(kim_gdata->uim_pid), SIGUSR2, 0);
 		if (err != 0) {
@@ -458,10 +454,9 @@
 			err = ST_ERR_FAILURE;
 			continue;
 		}
-#else
+#endif
 		/* unblock and send event to UIM via /dev/rfkill */
 		rfkill_set_hw_state(kim_gdata->rfkill[ST_BT], 0);
-#endif
 		/* wait for ldisc to be installed */
 		err = wait_for_completion_timeout(&kim_gdata->ldisc_installed,
 				msecs_to_jiffies(LDISC_TIME));
@@ -491,17 +486,16 @@
 	long err = ST_SUCCESS;
 
 	INIT_COMPLETION(kim_gdata->ldisc_installed);
-#ifndef LEGACY_RFKILL_SUPPORT
+#if 0 /* older way of signalling user-space UIM */
 	/* send signal to UIM */
 	err = kill_pid(find_get_pid(kim_gdata->uim_pid), SIGUSR2, 1);
 	if (err != 0) {
 		pr_err("sending SIGUSR2 to uim failed %ld", err);
 		return ST_ERR_FAILURE;
 	}
-#else
+#endif
 	/* set BT rfkill to be blocked */
 	err = rfkill_set_hw_state(kim_gdata->rfkill[ST_BT], 1);
-#endif
 
 	/* wait for ldisc to be un-installed */
 	err = wait_for_completion_timeout(&kim_gdata->ldisc_installed,
@@ -523,7 +517,6 @@
 /**********************************************************************/
 /* functions called from subsystems */
 
-#ifndef LEGACY_RFKILL_SUPPORT
 /* called when sysfs entry is written to */
 static ssize_t store_pid(struct device *dev, struct device_attribute
 			 *devattr, char *buf, size_t count)
@@ -551,8 +544,6 @@
 	return strlen(buf);
 }
 
-#else /* LEGACY_RFKILL_SUPPORT */
-
 /* function called from rfkill subsystem, when someone from
  * user space would write 0/1 on the sysfs entry
  * /sys/class/rfkill/rfkill0,1,3/state
@@ -580,8 +571,6 @@
 	return ST_SUCCESS;
 }
 
-#endif	/* LEGACY_RFKILL_SUPPORT */
-
 void st_kim_ref(struct st_data_s **core_data)
 {
 	*core_data = kim_gdata->core_data;
@@ -639,30 +628,12 @@
 			return status;
 		}
 	}
-#ifndef LEGACY_RFKILL_SUPPORT
-	/* pdev to contain BT, FM and GPS enable/N-Shutdown GPIOs
-	 * execute request_gpio, set output direction
-	 */
-	kim_gdata->kim_kobj = kobject_create_and_add("uim", NULL);
-	/* create the sysfs entry for UIM to put in pid */
-	if (sysfs_create_group(kim_gdata->kim_kobj, &uim_attr_grp)) {
-		pr_err(" sysfs entry creation failed");
-		kobject_put(kim_gdata->kim_kobj);
-		/* free requested GPIOs and fail probe */
-		for (proto = ST_BT; proto < ST_MAX; proto++) {
-			if (gpios[proto] != -1)
-				gpio_free(gpios[proto]);
-		}
-		return -1;	/* fail insmod */
-	}
-	pr_info(" sysfs entry created ");
-#endif
 	/* get reference of pdev for request_firmware
 	 */
 	kim_gdata->kim_pdev = pdev;
 	init_completion(&kim_gdata->kim_rcvd);
 	init_completion(&kim_gdata->ldisc_installed);
-#ifdef LEGACY_RFKILL_SUPPORT
+
 	for (proto = 0; (proto < ST_MAX) && (gpios[proto] != -1); proto++) {
 		/* TODO: should all types be rfkill_type_bt ? */
 		kim_gdata->rf_protos[proto] = proto;
@@ -685,7 +656,6 @@
 		}
 		pr_info("rfkill entry created for %ld", gpios[proto]);
 	}
-#endif
 	return ST_SUCCESS;
 }
 
@@ -701,18 +671,11 @@
 		 * nShutdown gpio from the system
 		 */
 		gpio_free(gpios[proto]);
-#ifdef LEGACY_RFKILL_SUPPORT
 		rfkill_unregister(kim_gdata->rfkill[proto]);
 		rfkill_destroy(kim_gdata->rfkill[proto]);
 		kim_gdata->rfkill[proto] = NULL;
-#endif
 	}
 	pr_info("kim: GPIO Freed");
-#ifndef LEGACY_RFKILL_SUPPORT
-	/* delete the sysfs entries */
-	sysfs_remove_group(kim_gdata->kim_kobj, &uim_attr_grp);
-	kobject_put(kim_gdata->kim_kobj);
-#endif
 	kim_gdata->kim_pdev = NULL;
 	st_core_exit(kim_gdata->core_data);
 	return ST_SUCCESS;