From e9abeff9fb94dcc00cae676d9eb45a9eec7ea992 Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Mon, 26 Oct 2015 21:11:30 +0100 Subject: [PATCH] bcwc_pcie: add channel pointer to private struct --- bcwc_drv.h | 8 ++++++++ isp.c | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/bcwc_drv.h b/bcwc_drv.h index 4bdad4e..cc7e1ec 100644 --- a/bcwc_drv.h +++ b/bcwc_drv.h @@ -77,6 +77,14 @@ struct bcwc_private { /* Firmware channels */ int num_channels; struct fw_channel **channels; + struct fw_channel *channel_terminal; + struct fw_channel *channel_io; + struct fw_channel *channel_debug; + struct fw_channel *channel_buf_h2t; + struct fw_channel *channel_buf_t2h; + struct fw_channel *channel_shared_malloc; + struct fw_channel *channel_io_t2h; + }; #endif diff --git a/isp.c b/isp.c index 0546b16..979f28e 100644 --- a/isp.c +++ b/isp.c @@ -192,6 +192,16 @@ static void isp_free_channel_info(struct bcwc_private *priv) priv->channels = NULL; } +static struct fw_channel *isp_get_chan_index(struct bcwc_private *priv, const char *name) +{ + int i; + for(i = 0; i < priv->num_channels; i++) { + if (!strcasecmp(priv->channels[i]->name, name)) + return priv->channels[i]; + } + return NULL; +} + static int isp_fill_channel_info(struct bcwc_private *priv, int offset, int num_channels) { struct isp_channel_info *info; @@ -227,6 +237,22 @@ static int isp_fill_channel_info(struct bcwc_private *priv, int offset, int num_ chan->size = info->size; chan->offset = info->offset; } + + priv->channel_terminal = isp_get_chan_index(priv, "TERMINAL"); + priv->channel_debug = isp_get_chan_index(priv, "DEBUG"); + priv->channel_shared_malloc = isp_get_chan_index(priv, "SHAREDMALLOC"); + priv->channel_io = isp_get_chan_index(priv, "IO"); + priv->channel_buf_h2t = isp_get_chan_index(priv, "BUF_H2T"); + priv->channel_buf_t2h = isp_get_chan_index(priv, "BUF_T2H"); + priv->channel_io_t2h = isp_get_chan_index(priv, "IO_T2H"); + + if (!priv->channel_terminal || !priv->channel_debug + || !priv->channel_shared_malloc || !priv->channel_io + || !priv->channel_buf_h2t || !priv->channel_buf_t2h + || !priv->channel_io_t2h) { + dev_err(&priv->pdev->dev, "did not find all of the required channels\n"); + goto out; + } return 0; out: isp_free_channel_info(priv);