bus.c (7d0bc6360f17ea323ab25939a34857123d7d87e5) | bus.c (22779149e93d956e9d266f545b26e548bf5b132d) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2021 ARM Ltd. 4 */ 5 6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 7 8#include <linux/arm_ffa.h> 9#include <linux/device.h> 10#include <linux/fs.h> 11#include <linux/kernel.h> 12#include <linux/module.h> 13#include <linux/slab.h> 14#include <linux/types.h> 15 16#include "common.h" 17 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2021 ARM Ltd. 4 */ 5 6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 7 8#include <linux/arm_ffa.h> 9#include <linux/device.h> 10#include <linux/fs.h> 11#include <linux/kernel.h> 12#include <linux/module.h> 13#include <linux/slab.h> 14#include <linux/types.h> 15 16#include "common.h" 17 |
18#define SCMI_UEVENT_MODALIAS_FMT "arm_ffa:%04x:%pUb" 19 |
|
18static DEFINE_IDA(ffa_bus_id); 19 20static int ffa_device_match(struct device *dev, struct device_driver *drv) 21{ 22 const struct ffa_device_id *id_table; 23 struct ffa_device *ffa_dev; 24 25 id_table = to_ffa_driver(drv)->id_table; --- 32 unchanged lines hidden (view full) --- 58 if (ffa_drv->remove) 59 ffa_drv->remove(to_ffa_dev(dev)); 60} 61 62static int ffa_device_uevent(const struct device *dev, struct kobj_uevent_env *env) 63{ 64 const struct ffa_device *ffa_dev = to_ffa_dev(dev); 65 | 20static DEFINE_IDA(ffa_bus_id); 21 22static int ffa_device_match(struct device *dev, struct device_driver *drv) 23{ 24 const struct ffa_device_id *id_table; 25 struct ffa_device *ffa_dev; 26 27 id_table = to_ffa_driver(drv)->id_table; --- 32 unchanged lines hidden (view full) --- 60 if (ffa_drv->remove) 61 ffa_drv->remove(to_ffa_dev(dev)); 62} 63 64static int ffa_device_uevent(const struct device *dev, struct kobj_uevent_env *env) 65{ 66 const struct ffa_device *ffa_dev = to_ffa_dev(dev); 67 |
66 return add_uevent_var(env, "MODALIAS=arm_ffa:%04x:%pUb", | 68 return add_uevent_var(env, "MODALIAS=" SCMI_UEVENT_MODALIAS_FMT, |
67 ffa_dev->vm_id, &ffa_dev->uuid); 68} 69 | 69 ffa_dev->vm_id, &ffa_dev->uuid); 70} 71 |
72static ssize_t modalias_show(struct device *dev, 73 struct device_attribute *attr, char *buf) 74{ 75 struct ffa_device *ffa_dev = to_ffa_dev(dev); 76 77 return sysfs_emit(buf, SCMI_UEVENT_MODALIAS_FMT, ffa_dev->vm_id, 78 &ffa_dev->uuid); 79} 80static DEVICE_ATTR_RO(modalias); 81 |
|
70static ssize_t partition_id_show(struct device *dev, 71 struct device_attribute *attr, char *buf) 72{ 73 struct ffa_device *ffa_dev = to_ffa_dev(dev); 74 75 return sprintf(buf, "0x%04x\n", ffa_dev->vm_id); 76} 77static DEVICE_ATTR_RO(partition_id); --- 5 unchanged lines hidden (view full) --- 83 84 return sprintf(buf, "%pUb\n", &ffa_dev->uuid); 85} 86static DEVICE_ATTR_RO(uuid); 87 88static struct attribute *ffa_device_attributes_attrs[] = { 89 &dev_attr_partition_id.attr, 90 &dev_attr_uuid.attr, | 82static ssize_t partition_id_show(struct device *dev, 83 struct device_attribute *attr, char *buf) 84{ 85 struct ffa_device *ffa_dev = to_ffa_dev(dev); 86 87 return sprintf(buf, "0x%04x\n", ffa_dev->vm_id); 88} 89static DEVICE_ATTR_RO(partition_id); --- 5 unchanged lines hidden (view full) --- 95 96 return sprintf(buf, "%pUb\n", &ffa_dev->uuid); 97} 98static DEVICE_ATTR_RO(uuid); 99 100static struct attribute *ffa_device_attributes_attrs[] = { 101 &dev_attr_partition_id.attr, 102 &dev_attr_uuid.attr, |
103 &dev_attr_modalias.attr, |
|
91 NULL, 92}; 93ATTRIBUTE_GROUPS(ffa_device_attributes); 94 95struct bus_type ffa_bus_type = { 96 .name = "arm_ffa", 97 .match = ffa_device_match, 98 .probe = ffa_device_probe, --- 134 unchanged lines hidden --- | 104 NULL, 105}; 106ATTRIBUTE_GROUPS(ffa_device_attributes); 107 108struct bus_type ffa_bus_type = { 109 .name = "arm_ffa", 110 .match = ffa_device_match, 111 .probe = ffa_device_probe, --- 134 unchanged lines hidden --- |