return ret;
 }
 
+static int __maybe_unused rproc_attach(struct rproc *rproc)
+{
+       struct device *dev = &rproc->dev;
+       int ret;
+
+       ret = rproc_prepare_subdevices(rproc);
+       if (ret) {
+               dev_err(dev, "failed to prepare subdevices for %s: %d\n",
+                       rproc->name, ret);
+               goto out;
+       }
+
+       /* Attach to the remote processor */
+       ret = rproc_attach_device(rproc);
+       if (ret) {
+               dev_err(dev, "can't attach to rproc %s: %d\n",
+                       rproc->name, ret);
+               goto unprepare_subdevices;
+       }
+
+       /* Start any subdevices for the remote processor */
+       ret = rproc_start_subdevices(rproc);
+       if (ret) {
+               dev_err(dev, "failed to probe subdevices for %s: %d\n",
+                       rproc->name, ret);
+               goto stop_rproc;
+       }
+
+       rproc->state = RPROC_RUNNING;
+
+       dev_info(dev, "remote processor %s is now attached\n", rproc->name);
+
+       return 0;
+
+stop_rproc:
+       rproc->ops->stop(rproc);
+unprepare_subdevices:
+       rproc_unprepare_subdevices(rproc);
+out:
+       return ret;
+}
+
 /*
  * take a firmware and boot a remote processor with it.
  */