Re: [PATCH 06/14] soundwire: add support for sdw_slave_type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





@@ -49,9 +49,16 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size)
  static int sdw_uevent(struct device *dev, struct kobj_uevent_env *env)
  {
-    struct sdw_slave *slave = to_sdw_slave_device(dev);
+    struct sdw_slave *slave;
      char modalias[32];
+    if (is_sdw_slave(dev)) {
+        slave = to_sdw_slave_device(dev);
+    } else {
+        dev_warn(dev, "uevent for unknown Soundwire type\n");
+        return -EINVAL;
+    }
+
      sdw_slave_modalias(slave, modalias, sizeof(modalias));
      if (add_uevent_var(env, "MODALIAS=%s", modalias))

Positive evaluation of is_sdw_slave() check is required for function to continue, thus you might as well do:

if (!is_sdw_slave(dev)) {
     dev_warn();
     return -EINVAL;
}

slave = to_sdw_slave_device(dev);

see the following patch 7, it becomes a 2-case test (slave and master).
I am all for optimizations but wait until the actual changes are added...
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux