Re: [PATCH 1/2] clk: qcom: clk-rpmh: Add QCOM RPMh clock driver

From: Stephen Boyd
Date: Thu Apr 05 2018 - 19:17:58 EST


Quoting Taniya Das (2018-04-02 03:33:26)
>
> >
> >> +
> >> +#include "common.h"
> >> +#include "clk-regmap.h"
> >> +
> >> +#define CLK_RPMH_ARC_EN_OFFSET 0
> >> +#define CLK_RPMH_VRM_EN_OFFSET 4
> >> +#define CLK_RPMH_VRM_OFF_VAL 0
> >> +#define CLK_RPMH_VRM_ON_VAL 1
> >> +#define CLK_RPMH_APPS_RSC_AO_STATE_MASK (BIT(RPMH_WAKE_ONLY_STATE) | \
> >> + BIT(RPMH_ACTIVE_ONLY_STATE))
> >> +#define CLK_RPMH_APPS_RSC_STATE_MASK (BIT(RPMH_WAKE_ONLY_STATE) | \
> >> + BIT(RPMH_ACTIVE_ONLY_STATE) | \
> >> + BIT(RPMH_SLEEP_STATE))
> >> +struct clk_rpmh {
> >> + const char *res_name;
> >> + u32 res_addr;
> >> + u32 res_en_offset;
> >> + u32 res_on_val;
> >> + u32 res_off_val;
> >> + u32 state;
> >> + u32 aggr_state;
> >> + u32 last_sent_aggr_state;
> >> + u32 valid_state_mask;
> >> + struct rpmh_client *rpmh_client;
> >> + unsigned long rate;
> >> + struct clk_rpmh *peer;
> >> + struct clk_hw hw;
> >
> > I believe this member should go at the beginning of the structure. At least
> > that's what everyone else seems to do, and that's what the clk.txt
> > documentation seems to ask for.
> >
>
> Yes I missed that, would update it in the next patch series.

Where is the documentation asking for that? There isn't any place that
clk_hw should be in a structure. container_of() can figure it out all
the time, and that macro is preferred instead of plain casts from one
type to another because it provides slightly more type safety.