Re: [PATCH 05/44 take 2] [UBI] internal common header

Arnd Bergmann
2007-02-17T21:06:59Z

On Saturday 17 February 2007 17:54, Artem Bityutskiy wrote:

> +/* Maximum number of supported UBI devices */
> +#define UBI_MAX_INSTANCES 32

Does this need to be limited?

> +/* UBI messages printk level */
> +#define UBI_MSG_LEVEL KERN_INFO
> +#define UBI_WARN_LEVEL KERN_WARNING
> +#define UBI_ERR_LEVEL KERN_ERR
> +
> +/* Prefixes of UBI messages */
> +#define UBI_MSG_PREF "UBI:"
> +#define UBI_WARN_PREF "UBI warning:"
> +#define UBI_ERR_PREF "UBI error:"
> +
> +/* Normal UBI messages */
> +#define ubi_msg(fmt, ...) \
> + printk(UBI_MSG_LEVEL UBI_MSG_PREF " " fmt "\n", ##__VA_ARGS__)
> +/* UBI warning messages */
> +#define ubi_warn(fmt, ...) \
> + printk(UBI_WARN_LEVEL UBI_WARN_PREF " %s: " fmt "\n", __FUNCTION__, \
> + ##__VA_ARGS__)
> +/* UBI error messages */
> +#define ubi_err(fmt, ...) \
> + printk(UBI_ERR_LEVEL UBI_ERR_PREF " %s " fmt "\n", __FUNCTION__, \
> + ##__VA_ARGS__)

You shouldn't need these helpers, just use the regular dev_dbg, dev_info
and related macros.

> +/**
> + * struct ubi_info - UBI device description structure
> + *
> + * @ubi_num: number of the UBI device
> + * @io: input/output unit information
> + * @bgt: background thread unit information
> + * @wl: wear-leveling unit information
> + * @beb: bad eraseblock handling unit information
> + * @vmt: volume management unit information
> + * @ivol: internal volume management unit information
> + * @vtbl: volume table unit information
> + * @acc: accounting unit information
> + * @upd: update unit information
> + * @eba: EBA unit information
> + * @uif: user interface unit information
> + */
> +struct ubi_info {
> + int ubi_num;
> + struct ubi_io_info *io;
> + struct ubi_bgt_info *bgt;
> + struct ubi_wl_info *wl;
> + struct ubi_beb_info *beb;
> + struct ubi_vmt_info *vmt;
> + struct ubi_ivol_info *ivol;
> + struct ubi_vtbl_info *vtbl;
> + struct ubi_acc_info *acc;
> + struct ubi_upd_info *upd;
> + struct ubi_eba_info *eba;
> + struct ubi_uif_info *uif;
> +};

I don't know what went wrong here, but this does not at all
look ok. The members in here probably should all be part
of the ubi_info structure itself.