static int src_set_state(struct src *src, unsigned int state)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_state(src->rsc.ctrl_blk, state);
return 0;
static int src_set_bm(struct src *src, unsigned int bm)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_bm(src->rsc.ctrl_blk, bm);
return 0;
static int src_set_sf(struct src *src, unsigned int sf)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_sf(src->rsc.ctrl_blk, sf);
return 0;
static int src_set_pm(struct src *src, unsigned int pm)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_pm(src->rsc.ctrl_blk, pm);
return 0;
static int src_set_rom(struct src *src, unsigned int rom)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_rom(src->rsc.ctrl_blk, rom);
return 0;
static int src_set_vo(struct src *src, unsigned int vo)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_vo(src->rsc.ctrl_blk, vo);
return 0;
static int src_set_st(struct src *src, unsigned int st)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_st(src->rsc.ctrl_blk, st);
return 0;
static int src_set_bp(struct src *src, unsigned int bp)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_bp(src->rsc.ctrl_blk, bp);
return 0;
static int src_set_cisz(struct src *src, unsigned int cisz)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_cisz(src->rsc.ctrl_blk, cisz);
return 0;
static int src_set_ca(struct src *src, unsigned int ca)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_ca(src->rsc.ctrl_blk, ca);
return 0;
static int src_set_sa(struct src *src, unsigned int sa)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_sa(src->rsc.ctrl_blk, sa);
return 0;
static int src_set_la(struct src *src, unsigned int la)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_la(src->rsc.ctrl_blk, la);
return 0;
static int src_set_pitch(struct src *src, unsigned int pitch)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_pitch(src->rsc.ctrl_blk, pitch);
return 0;
static int src_set_clear_zbufs(struct src *src)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
hw->src_set_clear_zbufs(src->rsc.ctrl_blk, 1);
return 0;
static int src_commit_write(struct src *src)
{
- struct hw *hw = NULL;
- int i = 0;
+ struct hw *hw;
+ int i;
unsigned int dirty = 0;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
src->rsc.ops->master(&src->rsc);
if (src->rsc.msr > 1) {
/* Save dirty flags for conjugate resource programming */
static int src_get_ca(struct src *src)
{
- struct hw *hw = NULL;
+ struct hw *hw;
- hw = (struct hw *)src->rsc.hw;
+ hw = src->rsc.hw;
return hw->src_get_ca(hw, src->rsc.ops->index(&src->rsc),
src->rsc.ctrl_blk);
}
static int src_default_config_memrd(struct src *src)
{
struct hw *hw = src->rsc.hw;
- unsigned int rsr = 0, msr = 0;
+ unsigned int rsr, msr;
hw->src_set_state(src->rsc.ctrl_blk, SRC_STATE_OFF);
hw->src_set_bm(src->rsc.ctrl_blk, 1);
static int src_default_config_arcrw(struct src *src)
{
struct hw *hw = src->rsc.hw;
- unsigned int rsr = 0, msr = 0;
+ unsigned int rsr, msr;
unsigned int dirty;
hw->src_set_state(src->rsc.ctrl_blk, SRC_STATE_OFF);
src_rsc_init(struct src *src, u32 idx,
const struct src_desc *desc, struct src_mgr *mgr)
{
- int err = 0;
- int i = 0, n = 0;
+ int err;
+ int i, n;
struct src *p;
n = (MEMRD == desc->mode) ? desc->multi : 1;
static int src_rsc_uninit(struct src *src, struct src_mgr *mgr)
{
- int i = 0, n = 0;
+ int i, n;
struct src *p;
n = (MEMRD == src->mode) ? src->multi : 1;
get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc)
{
unsigned int idx = SRC_RESOURCE_NUM;
- int err = 0;
- struct src *src = NULL;
+ int err;
+ struct src *src;
unsigned long flags;
*rsrc = NULL;
spin_unlock_irqrestore(&mgr->mgr_lock, flags);
if (err) {
- printk(KERN_ERR "Can't meet SRC resource request!\n");
+ printk(KERN_ERR "ctxfi: Can't meet SRC resource request!\n");
return err;
}
else
src = kzalloc(sizeof(*src), GFP_KERNEL);
- if (NULL == src) {
+ if (!src) {
err = -ENOMEM;
goto error1;
}
static int src_enable_s(struct src_mgr *mgr, struct src *src)
{
struct hw *hw = mgr->mgr.hw;
- int i = 0;
+ int i;
src->rsc.ops->master(&src->rsc);
for (i = 0; i < src->rsc.msr; i++) {
static int src_enable(struct src_mgr *mgr, struct src *src)
{
struct hw *hw = mgr->mgr.hw;
- int i = 0;
+ int i;
src->rsc.ops->master(&src->rsc);
for (i = 0; i < src->rsc.msr; i++) {
static int src_disable(struct src_mgr *mgr, struct src *src)
{
struct hw *hw = mgr->mgr.hw;
- int i = 0;
+ int i;
src->rsc.ops->master(&src->rsc);
for (i = 0; i < src->rsc.msr; i++) {
int src_mgr_create(void *hw, struct src_mgr **rsrc_mgr)
{
- int err = 0, i = 0;
+ int err, i;
struct src_mgr *src_mgr;
*rsrc_mgr = NULL;
src_mgr = kzalloc(sizeof(*src_mgr), GFP_KERNEL);
- if (NULL == src_mgr)
+ if (!src_mgr)
return -ENOMEM;
err = rsc_mgr_init(&src_mgr->mgr, SRC, SRC_RESOURCE_NUM, hw);
static int srcimp_map(struct srcimp *srcimp, struct src *src, struct rsc *input)
{
- struct imapper *entry = NULL;
- int i = 0;
+ struct imapper *entry;
+ int i;
srcimp->rsc.ops->master(&srcimp->rsc);
src->rsc.ops->master(&src->rsc);
static int srcimp_unmap(struct srcimp *srcimp)
{
- int i = 0;
+ int i;
/* Program master and conjugate resources */
for (i = 0; i < srcimp->rsc.msr; i++) {
const struct srcimp_desc *desc,
struct srcimp_mgr *mgr)
{
- int err = 0;
+ int err;
err = rsc_init(&srcimp->rsc, srcimp->idx[0],
SRCIMP, desc->msr, mgr->mgr.hw);
/* Reserve memory for imapper nodes */
srcimp->imappers = kzalloc(sizeof(struct imapper)*desc->msr,
GFP_KERNEL);
- if (NULL == srcimp->imappers) {
+ if (!srcimp->imappers) {
err = -ENOMEM;
goto error1;
}
const struct srcimp_desc *desc,
struct srcimp **rsrcimp)
{
- int err = 0, i = 0;
- unsigned int idx = 0;
- struct srcimp *srcimp = NULL;
+ int err, i;
+ unsigned int idx;
+ struct srcimp *srcimp;
unsigned long flags;
*rsrcimp = NULL;
/* Allocate mem for SRCIMP resource */
srcimp = kzalloc(sizeof(*srcimp), GFP_KERNEL);
- if (NULL == srcimp) {
- err = -ENOMEM;
- return err;
- }
+ if (!srcimp)
+ return -ENOMEM;
/* Check whether there are sufficient SRCIMP resources. */
+ err = 0;
spin_lock_irqsave(&mgr->mgr_lock, flags);
for (i = 0; i < desc->msr; i++) {
err = mgr_get_resource(&mgr->mgr, 1, &idx);
}
spin_unlock_irqrestore(&mgr->mgr_lock, flags);
if (err) {
- printk(KERN_ERR "Can't meet SRCIMP resource request!\n");
+ printk(KERN_ERR "ctxfi: Can't meet SRCIMP resource request!\n");
goto error1;
}
static int put_srcimp_rsc(struct srcimp_mgr *mgr, struct srcimp *srcimp)
{
unsigned long flags;
- int i = 0;
+ int i;
spin_lock_irqsave(&mgr->mgr_lock, flags);
for (i = 0; i < srcimp->rsc.msr; i++)
static int srcimp_imap_add(struct srcimp_mgr *mgr, struct imapper *entry)
{
unsigned long flags;
- int err = 0;
+ int err;
spin_lock_irqsave(&mgr->imap_lock, flags);
if ((0 == entry->addr) && (mgr->init_imap_added)) {
static int srcimp_imap_delete(struct srcimp_mgr *mgr, struct imapper *entry)
{
unsigned long flags;
- int err = 0;
+ int err;
spin_lock_irqsave(&mgr->imap_lock, flags);
err = input_mapper_delete(&mgr->imappers, entry, srcimp_map_op, mgr);
int srcimp_mgr_create(void *hw, struct srcimp_mgr **rsrcimp_mgr)
{
- int err = 0;
+ int err;
struct srcimp_mgr *srcimp_mgr;
struct imapper *entry;
*rsrcimp_mgr = NULL;
srcimp_mgr = kzalloc(sizeof(*srcimp_mgr), GFP_KERNEL);
- if (NULL == srcimp_mgr)
+ if (!srcimp_mgr)
return -ENOMEM;
err = rsc_mgr_init(&srcimp_mgr->mgr, SRCIMP, SRCIMP_RESOURCE_NUM, hw);
spin_lock_init(&srcimp_mgr->imap_lock);
INIT_LIST_HEAD(&srcimp_mgr->imappers);
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
- if (NULL == entry) {
+ if (!entry) {
err = -ENOMEM;
goto error2;
}