/* Constructor for the host1x device list */ int host1x_channel_list_init(struct host1x_channel_list *chlist, unsignedint num_channels)
{
chlist->channels = kcalloc(num_channels, sizeof(struct host1x_channel),
GFP_KERNEL); if (!chlist->channels) return -ENOMEM;
/** * host1x_channel_get_index() - Attempt to get channel reference by index * @host: Host1x device object * @index: Index of channel * * If channel number @index is currently allocated, increase its refcount * and return a pointer to it. Otherwise, return NULL.
*/ struct host1x_channel *host1x_channel_get_index(struct host1x *host, unsignedint index)
{ struct host1x_channel *ch = &host->channel_list.channels[index];
if (!kref_get_unless_zero(&ch->refcount)) return NULL;
index = find_first_zero_bit(chlist->allocated_channels, max_channels); if (index >= max_channels) {
mutex_unlock(&chlist->lock);
dev_err(host->dev, "failed to find free channel\n"); return NULL;
}
chlist->channels[index].id = index;
set_bit(index, chlist->allocated_channels);
mutex_unlock(&chlist->lock);
return &chlist->channels[index];
}
/** * host1x_channel_request() - Allocate a channel * @client: Host1x client this channel will be used to send commands to * * Allocates a new host1x channel for @client. May return NULL if CDMA * initialization fails.
*/ struct host1x_channel *host1x_channel_request(struct host1x_client *client)
{ struct host1x *host = dev_get_drvdata(client->dev->parent); struct host1x_channel_list *chlist = &host->channel_list; struct host1x_channel *channel; int err;
channel = acquire_unused_channel(host); if (!channel) return NULL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.