From patchwork Mon Apr 22 14:03:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 2471981 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C8A2EDF23A for ; Mon, 22 Apr 2013 14:05:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753349Ab3DVOFH (ORCPT ); Mon, 22 Apr 2013 10:05:07 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:62999 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752837Ab3DVOFG (ORCPT ); Mon, 22 Apr 2013 10:05:06 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MLN00CNHTSGLVJ0@mailout2.samsung.com> for linux-media@vger.kernel.org; Mon, 22 Apr 2013 23:05:04 +0900 (KST) X-AuditID: cbfee61a-b7f156d000002a55-63-5175438f7390 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 15.47.10837.F8345715; Mon, 22 Apr 2013 23:05:03 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MLN004L3TQD2V50@mmp1.samsung.com>; Mon, 22 Apr 2013 23:05:03 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com, a.hajda@samsung.com, Sylwester Nawrocki Subject: [PATCH 01/12] s5c73m3: Fix remove() callback to free requested resources Date: Mon, 22 Apr 2013 16:03:36 +0200 Message-id: <1366639427-14253-2-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1366639427-14253-1-git-send-email-s.nawrocki@samsung.com> References: <1366639427-14253-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFJMWRmVeSWpSXmKPExsVy+t9jAd1+59JAg7tdNha31p1jtTjb9Ibd omfDVlaLw2/aWS1mTH7J5sDq0bdlFaPH501yAUxRXDYpqTmZZalF+nYJXBmPPl1kLJjAXXFt 3n22BsaHnF2MnBwSAiYSjc9mskDYYhIX7q1n62Lk4hASWMQosaXrECuE08EkMXvtG0aQKjYB Q4neo31gtoiAvMST3htsIDazQKXEhrVPmUFsYYFgiY8vLoNNZRFQlZjb8gMszivgJrHzzSf2 LkYOoG0KEnMm2YCEOQXcJb4sucEKYgsBlWxaeYN9AiPvAkaGVYyiqQXJBcVJ6bmGesWJucWl eel6yfm5mxjBIfJMagfjygaLQ4wCHIxKPLwrzUoDhVgTy4orcw8xSnAwK4nw3n1dEijEm5JY WZValB9fVJqTWnyIUZqDRUmc90CrdaCQQHpiSWp2ampBahFMlomDU6qBkXn9M8V99mmd6c+8 e00PF65usJzT1hJ9NPfLny0tLvunX/0buY71Ussxz34h9a8Zr70e9RrKT/dc3qrVsu7SSVO7 w2VVLOtPc217WcFxbaX7pY1tXL59BiZPDYyll0eE8tiHxm5a7pmfvsI+rf6k2JnpGTris2cK xDGv/PaW2Xkjo6dIv800JZbijERDLeai4kQAtp5kJQ0CAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Make sure v4l2_device_unregister_subdev() is called for both: oif and sensor subdev and both media entities are freed on driver removal. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park --- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c index b353c50..ce8fcf2 100644 --- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c +++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c @@ -1668,13 +1668,17 @@ out_err1: static int s5c73m3_remove(struct i2c_client *client) { - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct s5c73m3 *state = sensor_sd_to_s5c73m3(sd); + struct v4l2_subdev *oif_sd = i2c_get_clientdata(client); + struct s5c73m3 *state = oif_sd_to_s5c73m3(oif_sd); + struct v4l2_subdev *sensor_sd = &state->sensor_sd; - v4l2_device_unregister_subdev(sd); + v4l2_device_unregister_subdev(oif_sd); - v4l2_ctrl_handler_free(sd->ctrl_handler); - media_entity_cleanup(&sd->entity); + v4l2_ctrl_handler_free(oif_sd->ctrl_handler); + media_entity_cleanup(&oif_sd->entity); + + v4l2_device_unregister_subdev(sensor_sd); + media_entity_cleanup(&sensor_sd->entity); s5c73m3_unregister_spi_driver(state); s5c73m3_free_gpios(state);