mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 21:23:23 +00:00
media: s5p-mfc: constify s5p_mfc_buf_size structures
Static "s5p_mfc_buf_size*" structures are not modified by the driver, so they can be made const for code safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Aakarsh Jain <aakarsh.jain@samsung.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
dd761d3cf4
commit
e8cc4c0bc2
@ -1520,14 +1520,14 @@ static const struct dev_pm_ops s5p_mfc_pm_ops = {
|
|||||||
SET_SYSTEM_SLEEP_PM_OPS(s5p_mfc_suspend, s5p_mfc_resume)
|
SET_SYSTEM_SLEEP_PM_OPS(s5p_mfc_suspend, s5p_mfc_resume)
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s5p_mfc_buf_size_v5 mfc_buf_size_v5 = {
|
static const struct s5p_mfc_buf_size_v5 mfc_buf_size_v5 = {
|
||||||
.h264_ctx = MFC_H264_CTX_BUF_SIZE,
|
.h264_ctx = MFC_H264_CTX_BUF_SIZE,
|
||||||
.non_h264_ctx = MFC_CTX_BUF_SIZE,
|
.non_h264_ctx = MFC_CTX_BUF_SIZE,
|
||||||
.dsc = DESC_BUF_SIZE,
|
.dsc = DESC_BUF_SIZE,
|
||||||
.shm = SHARED_BUF_SIZE,
|
.shm = SHARED_BUF_SIZE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s5p_mfc_buf_size buf_size_v5 = {
|
static const struct s5p_mfc_buf_size buf_size_v5 = {
|
||||||
.fw = MAX_FW_SIZE,
|
.fw = MAX_FW_SIZE,
|
||||||
.cpb = MAX_CPB_SIZE,
|
.cpb = MAX_CPB_SIZE,
|
||||||
.priv = &mfc_buf_size_v5,
|
.priv = &mfc_buf_size_v5,
|
||||||
@ -1544,7 +1544,7 @@ static struct s5p_mfc_variant mfc_drvdata_v5 = {
|
|||||||
.use_clock_gating = true,
|
.use_clock_gating = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s5p_mfc_buf_size_v6 mfc_buf_size_v6 = {
|
static const struct s5p_mfc_buf_size_v6 mfc_buf_size_v6 = {
|
||||||
.dev_ctx = MFC_CTX_BUF_SIZE_V6,
|
.dev_ctx = MFC_CTX_BUF_SIZE_V6,
|
||||||
.h264_dec_ctx = MFC_H264_DEC_CTX_BUF_SIZE_V6,
|
.h264_dec_ctx = MFC_H264_DEC_CTX_BUF_SIZE_V6,
|
||||||
.other_dec_ctx = MFC_OTHER_DEC_CTX_BUF_SIZE_V6,
|
.other_dec_ctx = MFC_OTHER_DEC_CTX_BUF_SIZE_V6,
|
||||||
@ -1552,7 +1552,7 @@ static struct s5p_mfc_buf_size_v6 mfc_buf_size_v6 = {
|
|||||||
.other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V6,
|
.other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V6,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s5p_mfc_buf_size buf_size_v6 = {
|
static const struct s5p_mfc_buf_size buf_size_v6 = {
|
||||||
.fw = MAX_FW_SIZE_V6,
|
.fw = MAX_FW_SIZE_V6,
|
||||||
.cpb = MAX_CPB_SIZE_V6,
|
.cpb = MAX_CPB_SIZE_V6,
|
||||||
.priv = &mfc_buf_size_v6,
|
.priv = &mfc_buf_size_v6,
|
||||||
@ -1573,7 +1573,7 @@ static struct s5p_mfc_variant mfc_drvdata_v6 = {
|
|||||||
.num_clocks = 1,
|
.num_clocks = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = {
|
static const struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = {
|
||||||
.dev_ctx = MFC_CTX_BUF_SIZE_V7,
|
.dev_ctx = MFC_CTX_BUF_SIZE_V7,
|
||||||
.h264_dec_ctx = MFC_H264_DEC_CTX_BUF_SIZE_V7,
|
.h264_dec_ctx = MFC_H264_DEC_CTX_BUF_SIZE_V7,
|
||||||
.other_dec_ctx = MFC_OTHER_DEC_CTX_BUF_SIZE_V7,
|
.other_dec_ctx = MFC_OTHER_DEC_CTX_BUF_SIZE_V7,
|
||||||
@ -1581,7 +1581,7 @@ static struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = {
|
|||||||
.other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V7,
|
.other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V7,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s5p_mfc_buf_size buf_size_v7 = {
|
static const struct s5p_mfc_buf_size buf_size_v7 = {
|
||||||
.fw = MAX_FW_SIZE_V7,
|
.fw = MAX_FW_SIZE_V7,
|
||||||
.cpb = MAX_CPB_SIZE_V7,
|
.cpb = MAX_CPB_SIZE_V7,
|
||||||
.priv = &mfc_buf_size_v7,
|
.priv = &mfc_buf_size_v7,
|
||||||
@ -1607,7 +1607,7 @@ static struct s5p_mfc_variant mfc_drvdata_v7_3250 = {
|
|||||||
.num_clocks = 2,
|
.num_clocks = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s5p_mfc_buf_size_v6 mfc_buf_size_v8 = {
|
static const struct s5p_mfc_buf_size_v6 mfc_buf_size_v8 = {
|
||||||
.dev_ctx = MFC_CTX_BUF_SIZE_V8,
|
.dev_ctx = MFC_CTX_BUF_SIZE_V8,
|
||||||
.h264_dec_ctx = MFC_H264_DEC_CTX_BUF_SIZE_V8,
|
.h264_dec_ctx = MFC_H264_DEC_CTX_BUF_SIZE_V8,
|
||||||
.other_dec_ctx = MFC_OTHER_DEC_CTX_BUF_SIZE_V8,
|
.other_dec_ctx = MFC_OTHER_DEC_CTX_BUF_SIZE_V8,
|
||||||
@ -1615,7 +1615,7 @@ static struct s5p_mfc_buf_size_v6 mfc_buf_size_v8 = {
|
|||||||
.other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V8,
|
.other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V8,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s5p_mfc_buf_size buf_size_v8 = {
|
static const struct s5p_mfc_buf_size buf_size_v8 = {
|
||||||
.fw = MAX_FW_SIZE_V8,
|
.fw = MAX_FW_SIZE_V8,
|
||||||
.cpb = MAX_CPB_SIZE_V8,
|
.cpb = MAX_CPB_SIZE_V8,
|
||||||
.priv = &mfc_buf_size_v8,
|
.priv = &mfc_buf_size_v8,
|
||||||
@ -1641,7 +1641,7 @@ static struct s5p_mfc_variant mfc_drvdata_v8_5433 = {
|
|||||||
.num_clocks = 3,
|
.num_clocks = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s5p_mfc_buf_size_v6 mfc_buf_size_v10 = {
|
static const struct s5p_mfc_buf_size_v6 mfc_buf_size_v10 = {
|
||||||
.dev_ctx = MFC_CTX_BUF_SIZE_V10,
|
.dev_ctx = MFC_CTX_BUF_SIZE_V10,
|
||||||
.h264_dec_ctx = MFC_H264_DEC_CTX_BUF_SIZE_V10,
|
.h264_dec_ctx = MFC_H264_DEC_CTX_BUF_SIZE_V10,
|
||||||
.other_dec_ctx = MFC_OTHER_DEC_CTX_BUF_SIZE_V10,
|
.other_dec_ctx = MFC_OTHER_DEC_CTX_BUF_SIZE_V10,
|
||||||
@ -1650,7 +1650,7 @@ static struct s5p_mfc_buf_size_v6 mfc_buf_size_v10 = {
|
|||||||
.other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V10,
|
.other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V10,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s5p_mfc_buf_size buf_size_v10 = {
|
static const struct s5p_mfc_buf_size buf_size_v10 = {
|
||||||
.fw = MAX_FW_SIZE_V10,
|
.fw = MAX_FW_SIZE_V10,
|
||||||
.cpb = MAX_CPB_SIZE_V10,
|
.cpb = MAX_CPB_SIZE_V10,
|
||||||
.priv = &mfc_buf_size_v10,
|
.priv = &mfc_buf_size_v10,
|
||||||
|
@ -32,7 +32,7 @@ static int s5p_mfc_cmd_host2risc_v6(struct s5p_mfc_dev *dev, int cmd,
|
|||||||
static int s5p_mfc_sys_init_cmd_v6(struct s5p_mfc_dev *dev)
|
static int s5p_mfc_sys_init_cmd_v6(struct s5p_mfc_dev *dev)
|
||||||
{
|
{
|
||||||
struct s5p_mfc_cmd_args h2r_args;
|
struct s5p_mfc_cmd_args h2r_args;
|
||||||
struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;
|
const struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = s5p_mfc_hw_call(dev->mfc_ops, alloc_dev_context_buffer, dev);
|
ret = s5p_mfc_hw_call(dev->mfc_ops, alloc_dev_context_buffer, dev);
|
||||||
|
@ -221,14 +221,14 @@ struct s5p_mfc_buf_size_v6 {
|
|||||||
struct s5p_mfc_buf_size {
|
struct s5p_mfc_buf_size {
|
||||||
unsigned int fw;
|
unsigned int fw;
|
||||||
unsigned int cpb;
|
unsigned int cpb;
|
||||||
void *priv;
|
const void *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct s5p_mfc_variant {
|
struct s5p_mfc_variant {
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
unsigned int port_num;
|
unsigned int port_num;
|
||||||
u32 version_bit;
|
u32 version_bit;
|
||||||
struct s5p_mfc_buf_size *buf_size;
|
const struct s5p_mfc_buf_size *buf_size;
|
||||||
const char *fw_name[MFC_FW_MAX_VERSIONS];
|
const char *fw_name[MFC_FW_MAX_VERSIONS];
|
||||||
const char *clk_names[MFC_MAX_CLOCKS];
|
const char *clk_names[MFC_MAX_CLOCKS];
|
||||||
int num_clocks;
|
int num_clocks;
|
||||||
|
@ -445,7 +445,7 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
|
|||||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);
|
struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct v4l2_pix_format_mplane *pix_mp;
|
struct v4l2_pix_format_mplane *pix_mp;
|
||||||
struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size;
|
const struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size;
|
||||||
|
|
||||||
mfc_debug_enter();
|
mfc_debug_enter();
|
||||||
ret = vidioc_try_fmt(file, priv, f);
|
ret = vidioc_try_fmt(file, priv, f);
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx)
|
static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct s5p_mfc_dev *dev = ctx->dev;
|
struct s5p_mfc_dev *dev = ctx->dev;
|
||||||
struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv;
|
const struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ctx->dsc.size = buf_size->dsc;
|
ctx->dsc.size = buf_size->dsc;
|
||||||
@ -200,7 +200,7 @@ static void s5p_mfc_release_codec_buffers_v5(struct s5p_mfc_ctx *ctx)
|
|||||||
static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx)
|
static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct s5p_mfc_dev *dev = ctx->dev;
|
struct s5p_mfc_dev *dev = ctx->dev;
|
||||||
struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv;
|
const struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC ||
|
if (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC ||
|
||||||
@ -345,7 +345,7 @@ static void s5p_mfc_enc_calc_src_size_v5(struct s5p_mfc_ctx *ctx)
|
|||||||
static void s5p_mfc_set_dec_desc_buffer(struct s5p_mfc_ctx *ctx)
|
static void s5p_mfc_set_dec_desc_buffer(struct s5p_mfc_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct s5p_mfc_dev *dev = ctx->dev;
|
struct s5p_mfc_dev *dev = ctx->dev;
|
||||||
struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv;
|
const struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv;
|
||||||
|
|
||||||
mfc_write(dev, OFFSETA(ctx->dsc.dma), S5P_FIMV_SI_CH0_DESC_ADR);
|
mfc_write(dev, OFFSETA(ctx->dsc.dma), S5P_FIMV_SI_CH0_DESC_ADR);
|
||||||
mfc_write(dev, buf_size->dsc, S5P_FIMV_SI_CH0_DESC_SIZE);
|
mfc_write(dev, buf_size->dsc, S5P_FIMV_SI_CH0_DESC_SIZE);
|
||||||
|
@ -383,7 +383,7 @@ static void s5p_mfc_release_codec_buffers_v6(struct s5p_mfc_ctx *ctx)
|
|||||||
static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx)
|
static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct s5p_mfc_dev *dev = ctx->dev;
|
struct s5p_mfc_dev *dev = ctx->dev;
|
||||||
struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;
|
const struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mfc_debug_enter();
|
mfc_debug_enter();
|
||||||
@ -443,7 +443,7 @@ static void s5p_mfc_release_instance_buffer_v6(struct s5p_mfc_ctx *ctx)
|
|||||||
/* Allocate context buffers for SYS_INIT */
|
/* Allocate context buffers for SYS_INIT */
|
||||||
static int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev)
|
static int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev)
|
||||||
{
|
{
|
||||||
struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;
|
const struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mfc_debug_enter();
|
mfc_debug_enter();
|
||||||
@ -587,7 +587,7 @@ static int s5p_mfc_set_dec_stream_buffer_v6(struct s5p_mfc_ctx *ctx,
|
|||||||
{
|
{
|
||||||
struct s5p_mfc_dev *dev = ctx->dev;
|
struct s5p_mfc_dev *dev = ctx->dev;
|
||||||
const struct s5p_mfc_regs *mfc_regs = dev->mfc_regs;
|
const struct s5p_mfc_regs *mfc_regs = dev->mfc_regs;
|
||||||
struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size;
|
const struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size;
|
||||||
|
|
||||||
mfc_debug_enter();
|
mfc_debug_enter();
|
||||||
mfc_debug(2, "inst_no: %d, buf_addr: 0x%08x,\n"
|
mfc_debug(2, "inst_no: %d, buf_addr: 0x%08x,\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user