vdpa.c (a6a51adc6e8aafebfe0c4beb80e99694ea562b40) | vdpa.c (d4821902e43453b85b31329441a9f6ac071228a8) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * vDPA bus. 4 * 5 * Copyright (c) 2020, Red Hat. All rights reserved. 6 * Author: Jason Wang <jasowang@redhat.com> 7 * 8 */ --- 144 unchanged lines hidden (view full) --- 153} 154 155/** 156 * __vdpa_alloc_device - allocate and initilaize a vDPA device 157 * This allows driver to some prepartion after device is 158 * initialized but before registered. 159 * @parent: the parent device 160 * @config: the bus operations that is supported by this device | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * vDPA bus. 4 * 5 * Copyright (c) 2020, Red Hat. All rights reserved. 6 * Author: Jason Wang <jasowang@redhat.com> 7 * 8 */ --- 144 unchanged lines hidden (view full) --- 153} 154 155/** 156 * __vdpa_alloc_device - allocate and initilaize a vDPA device 157 * This allows driver to some prepartion after device is 158 * initialized but before registered. 159 * @parent: the parent device 160 * @config: the bus operations that is supported by this device |
161 * @ngroups: number of groups supported by this device |
|
161 * @size: size of the parent structure that contains private data 162 * @name: name of the vdpa device; optional. 163 * @use_va: indicate whether virtual address must be used by this device 164 * 165 * Driver should use vdpa_alloc_device() wrapper macro instead of 166 * using this directly. 167 * 168 * Return: Returns an error when parent/config/dma_dev is not set or fail to get 169 * ida. 170 */ 171struct vdpa_device *__vdpa_alloc_device(struct device *parent, 172 const struct vdpa_config_ops *config, | 162 * @size: size of the parent structure that contains private data 163 * @name: name of the vdpa device; optional. 164 * @use_va: indicate whether virtual address must be used by this device 165 * 166 * Driver should use vdpa_alloc_device() wrapper macro instead of 167 * using this directly. 168 * 169 * Return: Returns an error when parent/config/dma_dev is not set or fail to get 170 * ida. 171 */ 172struct vdpa_device *__vdpa_alloc_device(struct device *parent, 173 const struct vdpa_config_ops *config, |
174 unsigned int ngroups, |
|
173 size_t size, const char *name, 174 bool use_va) 175{ 176 struct vdpa_device *vdev; 177 int err = -EINVAL; 178 179 if (!config) 180 goto err; --- 16 unchanged lines hidden (view full) --- 197 198 vdev->dev.bus = &vdpa_bus; 199 vdev->dev.parent = parent; 200 vdev->dev.release = vdpa_release_dev; 201 vdev->index = err; 202 vdev->config = config; 203 vdev->features_valid = false; 204 vdev->use_va = use_va; | 175 size_t size, const char *name, 176 bool use_va) 177{ 178 struct vdpa_device *vdev; 179 int err = -EINVAL; 180 181 if (!config) 182 goto err; --- 16 unchanged lines hidden (view full) --- 199 200 vdev->dev.bus = &vdpa_bus; 201 vdev->dev.parent = parent; 202 vdev->dev.release = vdpa_release_dev; 203 vdev->index = err; 204 vdev->config = config; 205 vdev->features_valid = false; 206 vdev->use_va = use_va; |
207 vdev->ngroups = ngroups; |
|
205 206 if (name) 207 err = dev_set_name(&vdev->dev, "%s", name); 208 else 209 err = dev_set_name(&vdev->dev, "vdpa%u", vdev->index); 210 if (err) 211 goto err_name; 212 --- 1027 unchanged lines hidden --- | 208 209 if (name) 210 err = dev_set_name(&vdev->dev, "%s", name); 211 else 212 err = dev_set_name(&vdev->dev, "vdpa%u", vdev->index); 213 if (err) 214 goto err_name; 215 --- 1027 unchanged lines hidden --- |