linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mtd: nand: use unnamed union field
@ 2019-01-22  7:42 Masahiro Yamada
  2019-01-22  7:42 ` [PATCH 1/2] mtd: rawnand: use unnamed union in struct nand_op_instr Masahiro Yamada
  2019-01-22  7:42 ` [PATCH 2/2] mtd: rawnand: use unnamed union in struct nand_op_parser_pattern_elem Masahiro Yamada
  0 siblings, 2 replies; 8+ messages in thread
From: Masahiro Yamada @ 2019-01-22  7:42 UTC (permalink / raw)
  To: linux-mtd, Boris Brezillon, Miquel Raynal
  Cc: Masahiro Yamada, Thierry Reding, Brian Norris, Jonathan Hunter,
	Linus Walleij, linux-kernel, Marek Vasut, Stefan Agner,
	Richard Weinberger, David Woodhouse, Janusz Krzysztofik,
	linux-tegra, Boris Brezillon, Lucas Stach

The new exec_op() scheme takes advantage of union
in order to store instruction private data, which is mutually
exclusive.

I felt a bit annoyed with the long accessors.
At least, we can omit "ctx." by making the union anonymous.

I converted nand_op_instr and nand_op_parser_pattern_elem.

I still see more instances, e.g.

  struct nand_op_data_instr {
          unsigned int len;
          union {
                  void *in;
                  const void *out;
          } buf;
          bool force_8bit;
  };

We could convert this into:

  struct nand_op_data_instr {
          unsigned int len;
          union {
                  void *ibuf;
                  const void *obuf;
          };
          bool force_8bit;
  };

Or, if we want to match the struct to NAND_OP_*_INSTR,
we can split it into two structures.

  struct nand_op_data_in_instr {
          unsigned int len;
          void *buf;
          bool force_8bit;
  };

  struct nand_op_data_out_instr {
          unsigned int len;
          const void *buf;
          bool force_8bit;
  };

Anyway, let's see if people are positive about
this shortning.



Masahiro Yamada (2):
  mtd: rawnand: use unnamed union in struct nand_op_instr
  mtd: rawnand: use unnamed union in struct nand_op_parser_pattern_elem

 drivers/mtd/nand/raw/ams-delta.c    | 18 +++++------
 drivers/mtd/nand/raw/fsmc_nand.c    | 41 +++++++++++-------------
 drivers/mtd/nand/raw/marvell_nand.c | 16 +++++-----
 drivers/mtd/nand/raw/nand_base.c    | 64 ++++++++++++++++++-------------------
 drivers/mtd/nand/raw/tegra_nand.c   | 10 +++---
 drivers/mtd/nand/raw/vf610_nfc.c    | 14 ++++----
 include/linux/mtd/rawnand.h         | 36 ++++++++++-----------
 7 files changed, 97 insertions(+), 102 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-01-22  8:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22  7:42 [PATCH 0/2] mtd: nand: use unnamed union field Masahiro Yamada
2019-01-22  7:42 ` [PATCH 1/2] mtd: rawnand: use unnamed union in struct nand_op_instr Masahiro Yamada
2019-01-22  7:42 ` [PATCH 2/2] mtd: rawnand: use unnamed union in struct nand_op_parser_pattern_elem Masahiro Yamada
2019-01-22  7:49   ` Miquel Raynal
2019-01-22  8:00     ` Masahiro Yamada
2019-01-22  8:08       ` Miquel Raynal
2019-01-22  8:33         ` Boris Brezillon
2019-01-22  8:55           ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).