Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756482AbdLTUqY (ORCPT ); Wed, 20 Dec 2017 15:46:24 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:43544 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755637AbdLTUpl (ORCPT ); Wed, 20 Dec 2017 15:45:41 -0500 X-Google-Smtp-Source: ACJfBos6EBtoj76xBVEoD6O6LnCjdnTxB1z3xI+/mYf+Z9f8kWj2sLok4/tzTvJENAYpQ4lIpeQN6Q== From: Andrey Smirnov To: Lee Jones Cc: Andrey Smirnov , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Rob Herring , cphealy@gmail.com, Guenter Roeck , Lucas Stach , Nikita Yushchenko , Greg Kroah-Hartman , Pavel Machek , Andy Shevchenko , Johan Hovold , Sebastian Reichel , Philippe Ombredanne Subject: [PATCH v16 1/5] serdev: Make .remove in struct serdev_device_driver optional Date: Wed, 20 Dec 2017 12:45:13 -0800 Message-Id: <20171220204517.28313-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171220204517.28313-1-andrew.smirnov@gmail.com> References: <20171220204517.28313-1-andrew.smirnov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1588 Lines: 44 Using devres infrastructure it is possible to write a serdev driver that doesn't have any code that needs to be called as a part of .remove. Add code to make .remove optional. Cc: linux-kernel@vger.kernel.org Cc: linux-serial@vger.kernel.org Cc: Rob Herring Cc: cphealy@gmail.com Cc: Guenter Roeck Cc: Lucas Stach Cc: Nikita Yushchenko Cc: Lee Jones Cc: Greg Kroah-Hartman Cc: Pavel Machek Cc: Andy Shevchenko Cc: Johan Hovold Cc: Sebastian Reichel Cc: Philippe Ombredanne Acked-by: Pavel Machek Acked-by: Rob Herring Reviewed-by: Sebastian Reichel Reviewed-by: Guenter Roeck Signed-off-by: Andrey Smirnov --- drivers/tty/serdev/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index 1bef39828ca7..34050b439c1f 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -268,8 +268,8 @@ static int serdev_drv_probe(struct device *dev) static int serdev_drv_remove(struct device *dev) { const struct serdev_device_driver *sdrv = to_serdev_device_driver(dev->driver); - - sdrv->remove(to_serdev_device(dev)); + if (sdrv->remove) + sdrv->remove(to_serdev_device(dev)); return 0; } -- 2.14.3