public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hugo Villeneuve <hvilleneuve@dimonoff.com>
Subject: Re: [PATCH v3 7/8] serial: max3100: Extract to_max3100_port() helper macro
Date: Wed, 10 Apr 2024 09:17:28 +0200	[thread overview]
Message-ID: <889be591-93cc-4e80-bebe-04a6f8f58c70@kernel.org> (raw)
In-Reply-To: <20240409144721.638326-8-andriy.shevchenko@linux.intel.com>

On 09. 04. 24, 16:45, Andy Shevchenko wrote:
> Instead of using container_of() explicitly, introduce a helper macro.
> This saves a lot of lines of code.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
...
> @@ -110,6 +111,8 @@ struct max3100_port {
>   	struct timer_list	timer;
>   };
>   
> +#define to_max3100_port(port)	container_of(port, struct max3100_port, port)

This is wrong. If you pass something other than "port" to 
to_max3100_port(), the third arg of container_of() will explode.

Use an inline to avoid mistakes like this.

regards,
-- 
js
suse labs


  reply	other threads:[~2024-04-10  7:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 14:45 [PATCH v3 0/8] serial: max3100: Put into shape Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 1/8] serial: max3100: Enable TIOCM_LOOP Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 2/8] serial: max3100: Get crystal frequency via device property Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 3/8] serial: max3100: Remove duplicating irq field Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 4/8] serial: max3100: Switch to use dev_err_probe() Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 5/8] serial: max3100: Replace MODULE_ALIAS() with respective ID tables Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 6/8] serial: max3100: Switch to DEFINE_SIMPLE_DEV_PM_OPS() Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 7/8] serial: max3100: Extract to_max3100_port() helper macro Andy Shevchenko
2024-04-10  7:17   ` Jiri Slaby [this message]
2024-04-10 13:55     ` Andy Shevchenko
2024-04-09 14:45 ` [PATCH v3 8/8] serial: max3100: Sort headers Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=889be591-93cc-4e80-bebe-04a6f8f58c70@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hvilleneuve@dimonoff.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox