+static int __init rtl8366_smi_init(struct rtl8366_smi *smi)
+{
+ int err;
+
+ if (!smi->parent)
+ return -EINVAL;
+
+ err = gpio_request(smi->gpio_sda, dev_name(smi->parent));
+ if (err) {
+ dev_err(smi->parent, "gpio_request failed for %u, err=%d\n",
+ smi->gpio_sda, err);
+ goto err_out;
+ }
+
+ err = gpio_request(smi->gpio_sck, dev_name(smi->parent));
+ if (err) {
+ dev_err(smi->parent, "gpio_request failed for %u, err=%d\n",
+ smi->gpio_sck, err);
+ goto err_free_sda;
+ }
+
+ spin_lock_init(&smi->lock);
+
+ dev_info(smi->parent, "using GPIO pins %u (SDA) and %u (SCK)\n",
+ smi->gpio_sda, smi->gpio_sck);
+
+ return 0;
+
+ err_free_sda:
+ gpio_free(smi->gpio_sda);
+ err_out:
+ return err;
+}
+
+static void rtl8366_smi_cleanup(struct rtl8366_smi *smi)
+{
+ gpio_free(smi->gpio_sck);
+ gpio_free(smi->gpio_sda);
+}
+