Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754412AbdLTEBp (ORCPT ); Tue, 19 Dec 2017 23:01:45 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:34003 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754009AbdLTEAj (ORCPT ); Tue, 19 Dec 2017 23:00:39 -0500 X-Google-Smtp-Source: ACJfBotFuJfyqcA19SSTxsxeGBOSB1Bh9tIR8fWEXDVJ5YgfNWuBgrZCe3DbWvOSjGUOZ9pOLhH2SQ== 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 Subject: [PATCH v15 1/5] serdev: Make .remove in struct serdev_device_driver optional Date: Tue, 19 Dec 2017 20:00:13 -0800 Message-Id: <20171220040017.7605-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171220040017.7605-1-andrew.smirnov@gmail.com> References: <20171220040017.7605-1-andrew.smirnov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1541 Lines: 43 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 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