[PATCH v2 4/6] Add GPIO v2 ioctl decoding
Dmitry V. Levin
ldv at altlinux.org
Wed Jan 20 16:22:24 UTC 2021
On Mon, Jan 11, 2021 at 11:09:10PM +0800, Kent Gibson wrote:
[...]
> +static void
> +print_gpio_v2_line_attribute(struct tcb *const tcp,
> + struct gpio_v2_line_attribute *attr)
[...]
> +static void
> +print_gpio_v2_line_config_attribute(struct tcb *const tcp,
> + struct gpio_v2_line_config_attribute *attr)
Two more comments:
- of course you can add "struct tcb *" argument to every function,
but you don't have to do it if the argument is unused;
- try making pointers to constant objects where possible, e.g.
"const struct gpio_v2_line_attribute *",
"const struct gpio_v2_line_config_attribute *", etc.
[...]
> +static bool
> +print_gpio_v2_line_config_attr_array_member(struct tcb *tcp, void *elem_buf,
> + size_t elem_size, void *data)
> +{
> + print_gpio_v2_line_config_attribute(tcp,
> + (struct gpio_v2_line_config_attribute *)elem_buf);
This is fine, but the compiler is perfectly capable of doing the
implicit cast from "void *" to another pointer type.
--
ldv
More information about the Strace-devel
mailing list