Re: [PATCH 2/2] staging: tidspbridge: rmgr code cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ionut,

On Thu, Dec 9, 2010 at 3:47 PM, Ionut Nicu <ionut.nicu@xxxxxxxxx> wrote:
> Reorganized some code in the rmgr module to increase
> its readability. No functional changes were done.
>
> Signed-off-by: Ionut Nicu <ionut.nicu@xxxxxxxxxx>
> ---
>  drivers/staging/tidspbridge/rmgr/drv.c  |  171 +++++++++-----------
>  drivers/staging/tidspbridge/rmgr/node.c |   81 +++++-----
>  drivers/staging/tidspbridge/rmgr/rmm.c  |  266 +++++++++++++-----------------
>  3 files changed, 229 insertions(+), 289 deletions(-)
>
> diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c
> index e0fc895..71a9489 100644
> --- a/drivers/staging/tidspbridge/rmgr/drv.c
> +++ b/drivers/staging/tidspbridge/rmgr/drv.c
> @@ -304,40 +304,28 @@ int drv_proc_update_strm_res(u32 num_bufs, void *strm_resources)
...
> @@ -608,40 +596,28 @@ int drv_request_resources(u32 dw_context, u32 *dev_node_strg)
>        DBC_REQUIRE(dw_context != 0);
>        DBC_REQUIRE(dev_node_strg != NULL);
>
> -       /*
> -        *  Allocate memory to hold the string. This will live untill
> -        *  it is freed in the Release resources. Update the driver object
> -        *  list.
> -        */
> -
>        if (!drv_datap || !drv_datap->drv_object)
> -               status = -ENODATA;
> -       else
> -               pdrv_object = drv_datap->drv_object;
> -
> -       if (!status) {
> -               pszdev_node = kzalloc(sizeof(struct drv_ext), GFP_KERNEL);
> -               if (pszdev_node) {
> -                       strncpy(pszdev_node->sz_string,
> -                               (char *)dw_context, MAXREGPATHLENGTH - 1);
> -                       pszdev_node->sz_string[MAXREGPATHLENGTH - 1] = '\0';
> -                       /* Update the Driver Object List */
> -                       *dev_node_strg = (u32) pszdev_node->sz_string;
> -                       list_add_tail(&pszdev_node->link,
> -                                       &pdrv_object->dev_node_string);
> -               } else {
> -                       status = -ENOMEM;
> -                       *dev_node_strg = 0;
> -               }
> -       } else {
> -               dev_dbg(bridge, "%s: Failed to get Driver Object from Registry",
> -                       __func__);
> -               *dev_node_strg = 0;
> -       }
> +               return -ENODATA;
> +
> +       pdrv_object = drv_datap->drv_object;
> +       *dev_node_strg = 0;
> +
> +       pszdev_node = kzalloc(sizeof(struct drv_ext), GFP_KERNEL);
> +       if (!pszdev_node)
> +               return -ENOMEM;
> +
> +       strncpy(pszdev_node->sz_string, (char *)dw_context,
> +                       MAXREGPATHLENGTH - 1);
> +       pszdev_node->sz_string[MAXREGPATHLENGTH - 1] = '\0';
> +       *dev_node_strg = (u32) pszdev_node->sz_string;
> +
> +       /* Update the Driver Object List */
> +       list_add_tail((struct list_head *)pszdev_node,
> +                       &pdrv_object->dev_node_string);

I'm not quite comfortable casting to list_head ptr, given that there
is already a member of that type, if the struct type of pszdev_node is
moved around and the first member changes, there should be issues.

Any reason to use them in this patch?

Regards,

Omar
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux