Re: [RFC/PATCH] Block device for the ISS simulator

From: Benjamin Herrenschmidt
Date: Fri Oct 03 2008 - 08:21:57 EST


On Fri, 2008-10-03 at 08:03 -0400, Josh Boyer wrote:
> On Fri, Oct 03, 2008 at 10:08:42AM +1000, Benjamin Herrenschmidt wrote:
> >+static void iss_blk_setup(struct iss_blk *ib)
> >+{
> >+ unsigned long flags;
> >+ u32 stat;
> >+
> >+ pr_debug("iss_blk_setup %d\n", ib->devno);
> >+
> >+ spin_lock_irqsave(&iss_blk_reglock, flags);
> >+ out_8(iss_blk_regs->data, 0);
> >+ out_be32(&iss_blk_regs->devno, ib->devno);
> >+ out_8(&iss_blk_regs->cmd, ISS_BD_CMD_OPEN);
> >+ stat = in_be32(&iss_blk_regs->stat);
>
> Should probably use the ioread/iowrite functions instead of raw out/in.
> Same comment throughout.

Yeah well, old habits :-)

> >+ pr_debug(" -> ending request, rc = %d\n", rc);
> >+ if (rc)
> >+ end_request(req, 0); /* failure */
> >+ else
> >+ end_request(req, 1); /* success */
>
> Could possibly just do:
>
> end_request(req, (!rc));

I knew copy/pasting from a crap driver was going to come back and bite
me :)

> of_find_node_by_path increments the refcount for that node. Need to
> do an of_node_put when you are done.

Yup, suppose so.

> Shouldn't you unmap iss_blk_regs at this point?

Might be a good idea yeah.

Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/