/* Return value: 0 on success / other on failure  */
static int cmm_sysfs_register(struct sys_device *sysdev)
/* Return value: 0 on success / other on failure  */
static int cmm_sysfs_register(struct sys_device *sysdev)
{
	int i, rc;
	if ((rc = sysdev_class_register(&cmm_sysdev_class)))
		return rc;
	sysdev->id = 0;
	sysdev->cls = &cmm_sysdev_class;
	if ((rc = sysdev_register(sysdev)))
		goto class_unregister;
	for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) {
		if ((rc = sysdev_create_file(sysdev, cmm_attrs[i])))
			goto fail;
	}
	return 0;
fail:
	while (--i >= 0)
		sysdev_remove_file(sysdev, cmm_attrs[i]);
	sysdev_unregister(sysdev);
class_unregister:
	sysdev_class_unregister(&cmm_sysdev_class);
	return rc;
}