}
static DEVICE_ATTR_WO(new_device);
- static int __i2c_find_user_addr(struct device *dev, void *addrp)
++static int __i2c_find_user_addr(struct device *dev, const void *addrp)
+{
+ struct i2c_client *client = i2c_verify_client(dev);
- unsigned short addr = *(unsigned short *)addrp;
++ unsigned short addr = *(const unsigned short *)addrp;
+
+ return client && client->flags & I2C_CLIENT_USER &&
+ i2c_encode_flags_to_addr(client) == addr;
+}
+
/*
* And of course let the users delete the devices they instantiated, if
* they got it wrong. This interface can only be used to delete devices
if (err)
return err;
- return le16_to_cpu(reply);
+ return reply;
+}
+
- static int omnia_match_mcu_client(struct device *dev, void *data)
++static int omnia_match_mcu_client(struct device *dev, const void *data)
+{
+ struct i2c_client *client;
+
+ client = i2c_verify_client(dev);
+ if (!client)
+ return 0;
+
+ return client->addr == OMNIA_MCU_I2C_ADDR;
+}
+
+static int omnia_find_mcu_and_get_features(struct device *dev)
+{
+ struct device *mcu_dev;
+ int ret;
+
+ mcu_dev = device_find_child(dev->parent, NULL, omnia_match_mcu_client);
+ if (!mcu_dev)
+ return -ENODEV;
+
+ ret = omnia_mcu_get_features(i2c_verify_client(mcu_dev));
+
+ put_device(mcu_dev);
+
+ return ret;
}
static int omnia_leds_probe(struct i2c_client *client)
reg = <0x100>;
};
};
+
+ test-device@2 {
+ compatible = "test,rust-device";
+ reg = <0x2>;
+ };
};
+
+ platform-tests-2 {
+ // No #address-cells or #size-cells
+ node {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ test-device@100 {
+ compatible = "test-sub-device";
+ reg = <0x100 1>;
+ };
+ };
+ };
};
};
nattr->attr.mode = 0444;
nattr->size = info->sechdrs[i].sh_size;
nattr->private = (void *)info->sechdrs[i].sh_addr;
- nattr->read = sysfs_bin_attr_simple_read;
+ nattr->read_new = sysfs_bin_attr_simple_read;
- ++nattr;
+ *(gattr++) = nattr++;
}
++loaded;
}