Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7851e008 authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Greg Kroah-Hartman
Browse files

mei: drop reserved host client ids



The reserved host clients can be obsoleted now, a portion of the
platforms is shipped without iAMT enabled, where the reservation is not
relevant and for platforms with iAMT dynamic allocation is sufficient.
Dropping reserved ids makes enumeration more flexible and generic

Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6938c192
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ int mei_amthif_host_init(struct mei_device *dev, struct mei_me_client *me_cl)

	mei_cl_init(cl, dev);

	ret = mei_cl_link(cl, MEI_IAMTHIF_HOST_CLIENT_ID);
	ret = mei_cl_link(cl);
	if (ret < 0) {
		dev_err(dev->dev, "amthif: failed cl_link %d\n", ret);
		return ret;
+1 −1
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ static void mei_nfc(struct mei_cl_device *cldev)

	mutex_lock(&bus->device_lock);
	/* we need to connect to INFO GUID */
	cl = mei_cl_alloc_linked(bus, MEI_HOST_CLIENT_ID_ANY);
	cl = mei_cl_alloc_linked(bus);
	if (IS_ERR(cl)) {
		ret = PTR_ERR(cl);
		cl = NULL;
+1 −1
Original line number Diff line number Diff line
@@ -417,7 +417,7 @@ int mei_cldev_enable(struct mei_cl_device *cldev)

	if (!cl) {
		mutex_lock(&bus->device_lock);
		cl = mei_cl_alloc_linked(bus, MEI_HOST_CLIENT_ID_ANY);
		cl = mei_cl_alloc_linked(bus);
		mutex_unlock(&bus->device_lock);
		if (IS_ERR(cl))
			return PTR_ERR(cl);
+5 −10
Original line number Diff line number Diff line
@@ -587,27 +587,23 @@ struct mei_cl *mei_cl_allocate(struct mei_device *dev)
 * mei_cl_link - allocate host id in the host map
 *
 * @cl: host client
 * @id: fixed host id or MEI_HOST_CLIENT_ID_ANY (-1) for generic one
 *
 * Return: 0 on success
 *	-EINVAL on incorrect values
 *	-EMFILE if open count exceeded.
 */
int mei_cl_link(struct mei_cl *cl, int id)
int mei_cl_link(struct mei_cl *cl)
{
	struct mei_device *dev;
	long open_handle_count;
	int id;

	if (WARN_ON(!cl || !cl->dev))
		return -EINVAL;

	dev = cl->dev;

	/* If Id is not assigned get one*/
	if (id == MEI_HOST_CLIENT_ID_ANY)
		id = find_first_zero_bit(dev->host_clients_map,
					MEI_CLIENTS_MAX);

	id = find_first_zero_bit(dev->host_clients_map, MEI_CLIENTS_MAX);
	if (id >= MEI_CLIENTS_MAX) {
		dev_err(dev->dev, "id exceeded %d", MEI_CLIENTS_MAX);
		return -EMFILE;
@@ -1143,11 +1139,10 @@ int mei_cl_connect(struct mei_cl *cl, struct mei_me_client *me_cl,
 * mei_cl_alloc_linked - allocate and link host client
 *
 * @dev: the device structure
 * @id: fixed host id or MEI_HOST_CLIENT_ID_ANY (-1) for generic one
 *
 * Return: cl on success ERR_PTR on failure
 */
struct mei_cl *mei_cl_alloc_linked(struct mei_device *dev, int id)
struct mei_cl *mei_cl_alloc_linked(struct mei_device *dev)
{
	struct mei_cl *cl;
	int ret;
@@ -1158,7 +1153,7 @@ struct mei_cl *mei_cl_alloc_linked(struct mei_device *dev, int id)
		goto err;
	}

	ret = mei_cl_link(cl, id);
	ret = mei_cl_link(cl);
	if (ret)
		goto err;

+2 −2
Original line number Diff line number Diff line
@@ -107,10 +107,10 @@ struct mei_cl *mei_cl_allocate(struct mei_device *dev);
void mei_cl_init(struct mei_cl *cl, struct mei_device *dev);


int mei_cl_link(struct mei_cl *cl, int id);
int mei_cl_link(struct mei_cl *cl);
int mei_cl_unlink(struct mei_cl *cl);

struct mei_cl *mei_cl_alloc_linked(struct mei_device *dev, int id);
struct mei_cl *mei_cl_alloc_linked(struct mei_device *dev);

struct mei_cl_cb *mei_cl_read_cb(const struct mei_cl *cl,
				 const struct file *fp);
Loading