> > > + > > > + ret = devm_add_action_or_reset(dev, iio_backend_release, back); > > > + if (ret) > > > + return ret; > > > + > > > + link = device_link_add(dev, back->dev, DL_FLAG_AUTOREMOVE_CONSUMER); > > > + if (!link) > > > + pr_warn("%s: Could not link to supplier(%s)\n", dev_name(dev), > > > + dev_name(back->dev)); > > > > Why is that not an error and we try to carry on? > > I guess having the links are not really mandatory for the whole thing to work (more > like a nice to have). That's also how this is handled in another subsystems so I > figured it would be fine. > > But since you are speaking about this... After you pointing me to Bartosz's talk and > sawing it (as stuff like this is mentioned), I started to question this. The goal > with the above comment is that if you remove the backend, all the consumers are > automatically removed (unbound). Just not sure if that's what we always want (and we > are already handling the situation where a backend goes away with -ENODEV) as some > frontends could still be useful without the backend (I guess that could be > plausible). I think for now we don't really have such usecases so the links can make > sense (and we can figure something like optionally creating these links if we ever > need too) but having your inputs on this will definitely be valuable. I'm not keen on both trying to make everything tear down cleanly AND making sure it all works even if we don't. That just adds two code paths to test when either should be sufficient on its own. I don't really mind which. Bartosz's stuff is nice, but it may not be the right solution here. > > > > + > > > + pr_debug("%s: Found backend(%s) device\n", dev_name(dev), > > > + dev_name(back->dev)); > > > + return 0; > > > +} > > > + Jonathan