From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Dejin Zheng <zhengdejin5@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
FlorianSchandinat@gmx.de, Ralf Baechle <ralf@linux-mips.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
dri-devel <dri-devel@lists.freedesktop.org>,
linux-fbdev@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] console: console: Complete exception handling in newport_probe()
Date: Thu, 23 Apr 2020 17:25:49 +0200 [thread overview]
Message-ID: <051e7dee-d64c-c54c-6bdd-6e60444c0a26@samsung.com> (raw)
In-Reply-To: <CAHp75Vd8kC6ub-=pwe3QtdZ=FBqka3F1bbHea6__G5_Vm_ybcQ@mail.gmail.com>
On 4/23/20 5:05 PM, Andy Shevchenko wrote:
> On Thu, Apr 23, 2020 at 5:55 PM Bartlomiej Zolnierkiewicz
> <b.zolnierkie@samsung.com> wrote:
>
>>> + if (err)
>>> + iounmap((void *)npregs);
>>
>> Looks OK but while you are at it, could you please also add missing
>> release_mem_region() on error and on device removal:
>>
>> newport_addr = dev->resource.start + 0xF0000;
>> if (!request_mem_region(newport_addr, 0x10000, "Newport"))
>> return -ENODEV;
>>
>> npregs = (struct newport_regs *)/* ioremap cannot fail */
>> ioremap(newport_addr, sizeof(struct newport_regs));
>> console_lock();
>> err = do_take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
>> console_unlock();
>> return err;
>> }
>>
>> static void newport_remove(struct gio_device *dev)
>> {
>> give_up_console(&newport_con);
>> iounmap((void *)npregs);
>> }
>>
>> ?
>
> Don't you think that proper solution is rather switch to memremap()?
Doesn't seem to be a case here (used memory region in uncached).
On MIPS (this is MIPS-only driver):
...
#define ioremap(offset, size) \
__ioremap_mode((offset), (size), _CACHE_UNCACHED)
#define ioremap_uc ioremap
...
While memremap() is only for cacheable memory:
...
* memremap() - remap an iomem_resource as cacheable memory
* @offset: iomem resource start address
* @size: size of remap
* @flags: any of MEMREMAP_WB, MEMREMAP_WT, MEMREMAP_WC,
* MEMREMAP_ENC, MEMREMAP_DEC
...
>>> return err;
>>> }
>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
next prev parent reply other threads:[~2020-04-23 15:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200423142637eucas1p2ea543e281d96c75aa4292b49756f2146@eucas1p2.samsung.com>
2020-04-23 14:26 ` [PATCH v2] console: console: Complete exception handling in newport_probe() Dejin Zheng
2020-04-23 14:52 ` Andy Shevchenko
2020-04-23 16:03 ` Dejin Zheng
2020-04-23 14:55 ` Bartlomiej Zolnierkiewicz
2020-04-23 15:05 ` Andy Shevchenko
2020-04-23 15:25 ` Bartlomiej Zolnierkiewicz [this message]
2020-04-23 15:51 ` Dejin Zheng
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=051e7dee-d64c-c54c-6bdd-6e60444c0a26@samsung.com \
--to=b.zolnierkie@samsung.com \
--cc=FlorianSchandinat@gmx.de \
--cc=andy.shevchenko@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ralf@linux-mips.org \
--cc=tglx@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=zhengdejin5@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).