From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752445AbcA0CgA (ORCPT ); Tue, 26 Jan 2016 21:36:00 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:50212 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751646AbcA0Cf4 (ORCPT ); Tue, 26 Jan 2016 21:35:56 -0500 X-AuditID: cbfee690-f79646d000001316-95-56a82d0a34e4 Date: Wed, 27 Jan 2016 11:35:54 +0900 From: Andi Shyti To: Krzysztof Kozlowski Cc: Javier Martinez Canillas , linux-kernel@vger.kernel.org, Kukjin Kim , rtc-linux@googlegroups.com, Chanwoo Choi , Alexandre Belloni , Laxman Dewangan , linux-samsung-soc@vger.kernel.org Subject: Re: [PATCH v3 07/10] rtc: max77686: Use dev_warn() instead of pr_warn() Message-id: <20160127023554.GI14296@samsunx.samsung> References: <1453836020-29579-1-git-send-email-javier@osg.samsung.com> <1453836020-29579-8-git-send-email-javier@osg.samsung.com> <20160127012230.GE14296@samsunx.samsung> <56A82331.5050403@osg.samsung.com> <56A825F0.9000108@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline In-reply-to: <56A825F0.9000108@samsung.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsWyRsSkWJdLd0WYwad56hYd1xYzWVz/8pzV 4s3bNUwWr18YWvQ/fs1ssXTfahaLy7vmsFnMOL+PyWJ/ZwejA6fHk00XGT32TDzJ5rFpVSeb R2/zOzaPLf132T36tqxi9Pi8SS6APYrLJiU1J7MstUjfLoEr43PnW5aCOTwVT7tusjYwtnJ2 MXJySAiYSOz/sZcVwhaTuHBvPVsXIxeHkMAKRomXn7YywhTN2rybFSIxi1Hi1LH3LBDOR0aJ t39OsIBUsQioSty63AVmswloSjTd/sEGYosIGEoc3L2d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TFEBFYlXB+snMAKdidA8C0nzLCTNCxiZVzFKpBYkFxQnpeca5aWW6xUn5haX 5qXrJefnbmIEp4Bn0jsYD+9yP8QowMGoxMN7Y//yMCHWxLLiytxDjBIczEoivD1KK8KEeFMS K6tSi/Lji0pzUosPMZoCA2Qis5Rocj4wPeWVxBsam5gZWRqZG1oYGZsrifPuuxQZJiSQnliS mp2aWpBaBNPHxMEp1cDI/nf606ve8WKPCn8d397sZnOb6bUad6zcjrsbDugc3slj8mAOn7jL jm+q8X+LLE/POvqpLrlwQfDejGuad71exK7POlngU5TIMyWzwmz+9TsJqwpUvmZdL6kve50/ Ld9SKKH+2CrDjcvnNxUVtHjofupluz1Vm1drk7lwc6LaKxMF07XLTsQosRRnJBpqMRcVJwIA 5xoNlxcDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > On 01/26/2016 10:22 PM, Andi Shyti wrote: > >> Hi Javier, > >> > >>> if (tm->tm_year < 100) { > >>> - pr_warn("RTC can't handle year %d. Assume it's 2000.\n", > >>> - 1900 + tm->tm_year); > >>> + dev_warn(info->dev, > >>> + "RTC can't handle year %d. Assume it's 2000\n", > >>> + 1900 + tm->tm_year); > >>> return -EINVAL; > >> > >> Because we are returning an error value, why not use dev_err()? > >> > > > > You are absolutely right. Since the driver was using pr_warn(), I used > > dev_warn() but dev_err() would had been correct. > > Wait. The message says that "2000 will be assumed" which is not an > error. The message indicates that driver will proceed, thus the warning. > > However the driver won't proceed because the max77686_rtc_set_time() > will abort. This came from max8997 which has the same issue. > > This means that either message should be changed (dev_err() without the > "assume" verb) or the function should not abort and set the year to > 2000+something (then dev_warn()... look at rtc-ds3234.c and rtc-mcp795.c). > > The easiest would be to choose #1 - no changes in the logic. Nevertheless, the function fails, and those who call max77686_rtc_tm_to_data() fail as well, so, we are printing warning, but behaving as error. Either we print error and return error, or we print warning, we set: tm->tm_year = 100; /* don't know if I got the logic right */ and return 0 Right? Thanks, Andi From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout3.samsung.com (mailout3.samsung.com. [203.254.224.33]) by gmr-mx.google.com with ESMTPS id tn7si497569pac.1.2016.01.26.18.35.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Jan 2016 18:35:56 -0800 (PST) Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O1L00T35B7UPPC0@mailout3.samsung.com> for rtc-linux@googlegroups.com; Wed, 27 Jan 2016 11:35:54 +0900 (KST) Date: Wed, 27 Jan 2016 11:35:54 +0900 From: Andi Shyti To: Krzysztof Kozlowski Cc: Javier Martinez Canillas , linux-kernel@vger.kernel.org, Kukjin Kim , rtc-linux@googlegroups.com, Chanwoo Choi , Alexandre Belloni , Laxman Dewangan , linux-samsung-soc@vger.kernel.org Subject: [rtc-linux] Re: [PATCH v3 07/10] rtc: max77686: Use dev_warn() instead of pr_warn() Message-id: <20160127023554.GI14296@samsunx.samsung> References: <1453836020-29579-1-git-send-email-javier@osg.samsung.com> <1453836020-29579-8-git-send-email-javier@osg.samsung.com> <20160127012230.GE14296@samsunx.samsung> <56A82331.5050403@osg.samsung.com> <56A825F0.9000108@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 In-reply-to: <56A825F0.9000108@samsung.com> Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , > > On 01/26/2016 10:22 PM, Andi Shyti wrote: > >> Hi Javier, > >> > >>> if (tm->tm_year < 100) { > >>> - pr_warn("RTC can't handle year %d. Assume it's 2000.\n", > >>> - 1900 + tm->tm_year); > >>> + dev_warn(info->dev, > >>> + "RTC can't handle year %d. Assume it's 2000\n", > >>> + 1900 + tm->tm_year); > >>> return -EINVAL; > >> > >> Because we are returning an error value, why not use dev_err()? > >> > > > > You are absolutely right. Since the driver was using pr_warn(), I used > > dev_warn() but dev_err() would had been correct. > > Wait. The message says that "2000 will be assumed" which is not an > error. The message indicates that driver will proceed, thus the warning. > > However the driver won't proceed because the max77686_rtc_set_time() > will abort. This came from max8997 which has the same issue. > > This means that either message should be changed (dev_err() without the > "assume" verb) or the function should not abort and set the year to > 2000+something (then dev_warn()... look at rtc-ds3234.c and rtc-mcp795.c). > > The easiest would be to choose #1 - no changes in the logic. Nevertheless, the function fails, and those who call max77686_rtc_tm_to_data() fail as well, so, we are printing warning, but behaving as error. Either we print error and return error, or we print warning, we set: tm->tm_year = 100; /* don't know if I got the logic right */ and return 0 Right? Thanks, Andi -- -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.